summaryrefslogtreecommitdiff
path: root/src/mind/topology.test.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/mind/topology.test.js')
-rw-r--r--src/mind/topology.test.js23
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 ) ],
+ ]);
+});