I am looking at changing the hnn package to support different activation functions for every node in a network.
In particular, this line and this line use specific function (activation), but I am trying to extended that to support something like:
evalNet n@(Network{..}) inputs activations = do
s <- foldM (\x -> computeStepM n x (activations!!N)) state inputsV
where N
is the node id/index.
Currently I am a stage where I have my list of activation functions of the same length as amount of nodes in the network.
I need help (as I am lost in the package source code) to find a way to apply Nth
activations
function from the list.
EDIT: I have tried StateT
approach using tick
(from documentation) and using zip
function, both give multiple executions per every step, so the final result becomes wrong
For the map you may want something like
as = [(+1),(*2),(+(-3))]
xs = [4,5,6]
main = print $ zipWith ($) as xs
The fold is more complicated but can be done with using the same idea: Zip the inputs with according activation functions and change the function-folded-over to use the values of the incoming tuples.
However, I doubt you really need/want to change the fold. If I'm not mistaken the fold should just pass on the activation-functions list. So there's actually nothing to do.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.