summaryrefslogtreecommitdiff
path: root/src/mind/topology.test.js
diff options
context:
space:
mode:
authorsanine <sanine.not@pm.me>2023-06-11 22:50:42 -0500
committersanine <sanine.not@pm.me>2023-06-11 22:50:42 -0500
commit980a5350b5a4845db2bd5d6feb9f463a3c1a3aa6 (patch)
tree409c93483388b8cede754bc69fc62804a271c045 /src/mind/topology.test.js
parent3b0b005b952b1092404fdd5ae1732ec9561794af (diff)
add hidden neuron state
Diffstat (limited to 'src/mind/topology.test.js')
-rw-r--r--src/mind/topology.test.js39
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);
+//});