我对 Haskell 很陌生,并且一直在尝试解决这个问题。
我有一个功能:
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)
我需要传递 each(nodes layer)
和childLayer
to 函数calculateNodeError
如果需要,可以在此处找到其余代码(不多):https ://github.com/kennycason/haskell_nn/
非常感谢。