[Haskell-beginners] State Monad for neurons?
Amy de Buitléir
amy at nualeargais.ie
Wed Jul 28 12:41:11 EDT 2010
I'm implementing a cyclic neural network. At time t, each neuron will update
its output based on the outputs (at time t-1) of the neurons that it's
connected to. It will also update the weights for its connections according
to some learning rule, and it may destroy a connection or create a new one.
So far, the best way I can think of to do this is to have a master list of
neurons, and each neuron would know the indices for the other neurons it
connects to. I'd write a function to update the neuron (actually returning a
"new" neuron), and then do a "map" over the list with that function.
That seems OK, but I wonder if there's a better way. I suspect the State
monad could be used for this, but I can't figure out how to put the pieces
of the puzzle together. Here's what I was thinking:
- A connection could be a State monad, where the state is the source neuron
and the current weight, and the result would be the weighted input.
- A neuron could also be a State Monad, where the state is a list of
connections, and the result is the neuron's output.
I've read dozens of monad tutorials, but I can't figure out how to trigger
all the neurons to update themselves. Is the State Monad appropriate for
this problem?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/beginners/attachments/20100728/bc49a39a/attachment-0001.html
More information about the Beginners
mailing list