Published
Edited
Nov 3, 2020
1 fork
1 star
Insert cell
Insert cell
Insert cell
{
// Create the model
var p = new ss.perceptron();
// Train the model with input with a diagonal boundary.
for (var i = 0; i < 50; i++) {
p.train([1, 1], 1);
p.train([0, 1], 0);
p.train([1, 0], 0);
p.train([0, 0], 0);
}
return [
p.predict([0, 0]), // 0
p.predict([0, 1]), // 0
p.predict([1, 0]), // 0
p.predict([1, 1]), // 1
]
}
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
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