From b3b2ebddba2dad9f9213ac80cb95033ad48eb7e2 Mon Sep 17 00:00:00 2001 From: sanine Date: Sun, 11 Jun 2023 23:05:46 -0500 Subject: add deep networks --- src/mind/topology.test.js | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) (limited to 'src/mind/topology.test.js') diff --git a/src/mind/topology.test.js b/src/mind/topology.test.js index 7612c3d..5867763 100644 --- a/src/mind/topology.test.js +++ b/src/mind/topology.test.js @@ -169,10 +169,21 @@ test('hidden neurons', () => { }); -//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); -//}); +test('arbitrary hidden neurons', () => { + const n = network(1, 2, 1) + .connect(0, 1, 1) + .connect(1, 2, -1) + .connect(2, 3, 2) + + expect(n.compute([1], [0, 0])).toEqual([ + [ Math.tanh ( + 2*Math.tanh( + -1*Math.tanh( 1 ) + ) + ) ], + [ + Math.tanh( -Math.tanh(1) ), + Math.tanh(1), + ], + ]); +}); -- cgit v1.2.1