New Hopfield Network Code

28 views
Skip to first unread message

Justin Bozonier

unread,
Feb 3, 2009, 2:52:04 AM2/3/09
to Neural Networks Study Group
So I completely started from scratch and built my own Hopfield network
with my own Matrix class since I couldn't find one that seemed to work
well.

Here's the specs for it:
http://github.com/jcbozonier/master/blob/d0a1479d18b0e0f0111ce87cab3f80ecbf0fffe1/Exploratory/IntroToNeuralNetworksCSharp/HopfieldDemo/Specs/Four_Node_Specs.cs

The HopfieldNetwork object code:
http://github.com/jcbozonier/master/blob/d0a1479d18b0e0f0111ce87cab3f80ecbf0fffe1/Exploratory/IntroToNeuralNetworksCSharp/HopfieldDemo/SimpleMaths/HopfieldNetwork.cs

The HopfieldPattern object code:
http://github.com/jcbozonier/master/blob/d0a1479d18b0e0f0111ce87cab3f80ecbf0fffe1/Exploratory/IntroToNeuralNetworksCSharp/HopfieldDemo/SimpleMaths/HopfieldPattern.cs

And my extremely simplified matrix code:
http://github.com/jcbozonier/master/blob/d0a1479d18b0e0f0111ce87cab3f80ecbf0fffe1/Exploratory/IntroToNeuralNetworksCSharp/HopfieldDemo/SimpleMaths/Matrix.cs

I also figured out why I had to multiply by a -1 and then multiply the
two networks. I'm not so much multiplying by a -1 but initializing my
network to be all -1's at first. The difference is that -1 is "off".
'0' is kinda ambiguous. Then when I multiply the contribution matrices
against the individual matrices I'm essentially turning different
neurons off and on (since a -1 * 1 will essentially flip the sign).

Code critiques are welcome on this one. I'm pretty happy with it
considering it's just a couple hours work.
Reply all
Reply to author
Forward
0 new messages