diff options
Diffstat (limited to 'src/mind/topology.test.js')
-rw-r--r-- | src/mind/topology.test.js | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/src/mind/topology.test.js b/src/mind/topology.test.js index e1c5f87..7612c3d 100644 --- a/src/mind/topology.test.js +++ b/src/mind/topology.test.js @@ -137,3 +137,42 @@ test('multiple input network', () => { [], ]); }); + + +test('multiple outputs', () => { + const n = network(4, 0, 2) + .connect(0, 4, -1) + .connect(1, 4, 1) + .connect(2, 5, -1) + .connect(3, 5, 1); + + expect(n.compute([1,2,3,5], [])).toEqual([ + [ Math.tanh(2-1), Math.tanh(5-3) ], + [], + ]); +}); + + +test('hidden neurons', () => { + const n = network(4, 2, 1) + .connect(0, 4, -1) + .connect(1, 4, 1) + .connect(2, 5, -1) + .connect(3, 5, 1) + .connect(4, 6, -1) + .connect(5, 6, 1); + + expect(n.compute([1,2,3,5], [ 0, 0 ])).toEqual([ + [ Math.tanh( Math.tanh(5-3) - Math.tanh(2-1) ) ], + [ Math.tanh(2-1), Math.tanh(5-3) ], + ]); +}); + + +//test('arbitrary hidden neurons', () => { +// const n = network(1, 2, 1) +// .connect(0, 1, 1) +// .connect(1, 2, -1) +// .connect(2, 3, 2) +// .connect(3, 4, -2); +//}); |