diff options
author | sanine <sanine.not@pm.me> | 2023-06-11 23:21:46 -0500 |
---|---|---|
committer | sanine <sanine.not@pm.me> | 2023-06-11 23:21:46 -0500 |
commit | 7e92bd5b292b99c5f5a3f1b05d2870be32732d92 (patch) | |
tree | 0e5906fa2b7d81f90ea50a6de178c4fdfef5d6e0 /src/mind/topology.test.js | |
parent | b3b2ebddba2dad9f9213ac80cb95033ad48eb7e2 (diff) |
add memory
Diffstat (limited to 'src/mind/topology.test.js')
-rw-r--r-- | src/mind/topology.test.js | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/mind/topology.test.js b/src/mind/topology.test.js index 5867763..fbe1862 100644 --- a/src/mind/topology.test.js +++ b/src/mind/topology.test.js @@ -187,3 +187,26 @@ test('arbitrary hidden neurons', () => { ], ]); }); + + +test('memory', () => { + const n = network(0, 1, 1).connect(0, 0, -0.5).connect(0, 1, 2); + + expect(n.compute([], [1])).toEqual([ + [ Math.tanh( 2 * Math.tanh( -0.5 * 1 ) ) ], + [ Math.tanh( -0.5 * 1) ], + ]); +}); + + +test('memory and input', () => { + const n = network(1, 1, 1) + .connect(0, 1, 1) + .connect(1, 1, 1) + .connect(1, 2, 1); + + expect(n.compute([2], [-1])).toEqual([ + [ Math.tanh( Math.tanh( 2-1 ) ) ], + [ Math.tanh( 2-1 ) ], + ]); +}); |