11 lines
413 B
JavaScript
11 lines
413 B
JavaScript
|
import { Build, Learn, Label } from "./nn.ts";
|
||
|
|
||
|
const inputs = [[0.10, 0.50], [0.00, 0.06], [0.99, 0.85], [0.80, 0.95]];
|
||
|
const labels = [[ 0, 1 ], [ 0, 1 ], [ 1, 0 ], [ 1, 0 ]];
|
||
|
|
||
|
const layers = Build(2, 5, 2);
|
||
|
const errors = Learn(inputs, layers, labels, 1000, 0.1);
|
||
|
const output = Label(inputs, layers);
|
||
|
|
||
|
console.log("error after training:", errors);
|
||
|
console.log("re-classified inputs:", output);
|