Published
Edited
Mar 20, 2018
2 stars
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
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
function calculateLoss(target, hypothesis) {
return dl.mean(dl.square(target.sub(hypothesis)))
}
Insert cell
Insert cell
function model(input) {
const z1 = dl.tidy(function () {
return input.matMul(w1).add(b1).relu(); // Hidden Layer
});
return z1.matMul(w2).add(b2).sigmoid(); // Output Layer
}
Insert cell
Insert cell
training = {
let holder = 0;
while (isTraining && current_epoch.length < epoch) {
for (let i = 0; i < epoch; i++) {
// calculate Loss and Update Weights
let cost = optimizer.minimize(function() {
return calculateLoss(y_ , model(x_));
}, true);
holder = cost.dataSync();
current_epoch.push(holder[0]);
yield current_epoch;
// Update Loss Chart
}
}
yield current_epoch;
}
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
md`#### Misc HTML/Vega Variables`
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
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