Published
Edited
Jun 17, 2019
2 stars
Insert cell
Insert cell
Insert cell
Insert cell
XY = {
var temp = [];
for (var i = 0; i < 10000; i++) {
temp.push([Math.floor(Math.random() * 100) + 100, Math.floor(Math.random() * 100) + 100]);
}
var temp2 = [];
for (let obj of temp){
temp2.push(obj[0] + obj[1]);
}
return [tf.tensor2d(temp, [10000, 2])
, tf.tensor2d(temp2, [10000, 1])];
}
Insert cell
Insert cell
Insert cell
y.toString();
Insert cell
Insert cell
tf_model = {
const tmp_model = await tf.loadLayersModel('https://gist.githubusercontent.com/mircopp/2324d49c93cf209fbc35b315b5ab9466/raw/6e344d568ab5c6ec659513f2d417e8da16a5d1e4/model.json');
tmp_model.compile({optimizer : 'adam',
loss : 'meanSquaredError',
metrics : ['mae']});
return tmp_model;
}
Insert cell
Insert cell
tf_model.predict(X).toString();
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
tf_model_2 = {
const tmp_model = await tf.loadLayersModel(new ModelLoader(JSON.stringify(model)));
return tmp_model;
}
Insert cell
tf_model_2.predict(X).toString();
Insert cell
Insert cell
tfjs_vis = require('https://bundle.run/@tensorflow/tfjs-vis@1.1.0')
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more