Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- works ----------------------
- calcedLayer = foldl' k [] rl
- k c n = c `seq` c ++ [updateN n]
- updateN n = updateNeuron n (v_inputSum n) (v_state n) (weights n)
- v_inputSum n = calcNeuron ll (weights n)
- v_state n = sigmoidFunction (v_inputSum n)
- -- don't work ----------------------
- {--
- src/Backpropagation.hs:149:22:
- Couldn't match expected type `([Neuron], [Neuron])'
- against inferred type `[Neuron]'
- In the first argument of `foldl'', namely `updateNeuronList'
- In the expression: foldl' updateNeuronList ([], ll) rl
- In the definition of `calcedLayer':
- calcedLayer = foldl' updateNeuronList ([], ll) rl
- --}
- calcLayer :: [Neuron] -> [Neuron] -> [Neuron]
- calcLayer ll rl = calcedLayer where
- calcedLayer = foldl' updateNeuronList ([], ll) rl
- -- update layer of neurons
- -- avoiding unneeded laziness
- updateNeuronList :: ([Neuron], [Neuron]) -> Neuron -> [Neuron]
- updateNeuronList (x, ll) n = x `seq` ll `seq` (tmp, ll) where
- v_inputSum = calcNeuron ll (weights n)
- v_state = sigmoidFunction v_inputSum
- updated = updateNeuron n (v_inputSum) (v_state) (weights n)
- tmp = x ++ [updated]
- -- ----------------------
Add Comment
Please, Sign In to add comment