From 435c52c7330bcd49328a8facfc5a11b00e4a41bf Mon Sep 17 00:00:00 2001 From: sanine Date: Tue, 21 Nov 2023 23:41:38 -0600 Subject: implement self-connected computation --- test/MindTest.hs | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'test/MindTest.hs') diff --git a/test/MindTest.hs b/test/MindTest.hs index 7b208b4..efa79ef 100644 --- a/test/MindTest.hs +++ b/test/MindTest.hs @@ -131,4 +131,16 @@ networkTests = testGroup "network tests" $ , tanh (5-3) ] ) + , testCase "computing with self-connection" $ + let + net = Network 0 + -- hidden neurons + [ [ Edge (Internal 0, negate 0.5) ] ] + -- output neurons + [ [ Edge (Internal 0, 2) ] ] + Just result = compute net [] [1.0] + in result @?= + ( [ tanh $ 2 * (tanh (negate 0.5)) ] + , [ tanh (negate 0.5) ] + ) ] -- cgit v1.2.1