Published
Edited
Apr 12, 2022
1 fork
Insert cell
# Brain.js Issue #741
Insert cell
{
try {
const originNet = new brain.recurrent.LSTM({ hiddenLayers: [10] });
originNet.train([
{ input: ['1', '0'], output: ['1'], },
{ input: ['0', '0'], output: ['0'], },
{ input: ['1', '1'], output: ['0'], },
{ input: ['0', '1'], output: ['1'], },
], { iterations: 5000 });
const json = originNet.toJSON();
const newNet = new brain.recurrent.LSTM();
newNet.fromJSON(json);
return [
newNet.run(['1', '0']),
newNet.run(['0', '0']),
newNet.run(['1', '1']),
newNet.run(['0', '1']),
];
} catch (e) {
return e;
}
}
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