Published
Edited
Apr 13, 2022
Insert cell
Insert cell
{
const net = new brain.recurrent.LSTMTimeStep();
net.train([
{ input: [0, 0.5], output: [1] },
{ input: [1, 0.5], output: [0] },
{ input: [0, 0], output: [0] },
{ input: [0.5, 0.5], output: [0.5] },
], {
errorThresh: 0.08,
log: true
});
const fn = net.toFunction();
console.log(fn.toString());
return [
fn([0, 0.5]),
fn([1, 0.5]),
fn([0, 0]),
fn([0.5, 0.5]),
];
}
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