Reputation: 12328
I'm pretty new to Haskell, and have been trying to solve this for a while.
I have a function:
sumNodeError :: Node -> Layer -> Double
sumNodeError node childLayer = foldl (+) 0 (listProduct (weights node) (errors childLayer))
calculateNodeError :: Node -> Layer -> Double
calculateNodeError node childLayer = (sumNodeError node childLayer) * (value node) * (1.0 - (value node))
-- problem is in this function
calculateErrors :: Layer -> Layer -> Layer
calculateErrors layer childLayer = Layer (nodes layer)
(map calculateNodeError (nodes layer) childLayer ) -- problem, need to map each of the nodes in the layer, and the childLayer to calculateNodeError
(teacherSignals layer)
(learningRate layer)
I am needing to pass each (nodes layer)
and the childLayer
to function calculateNodeError
The rest of the code (which isn't much) can be found here if you need: https://github.com/kennycason/haskell_nn/
Thanks a lot.
Upvotes: 1
Views: 292
Reputation: 14623
Here is another solution.
map ((flip calculateNodeError) childLayer) (nodes layer)
Upvotes: 2
Reputation: 34421
Here you go
(map (\n -> calculateNodeError n childLayer) (nodes layer) )
Upvotes: 5