Advertisement
Manioc

fodeForte

Oct 25th, 2018
199
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. -- Modulo destinado a todas as funcoes relativas a execucao da Rede.
  2.  
  3. module Execution
  4. (execute,
  5.  initialize,
  6.  feedforward) where
  7.  
  8. import InputOutput
  9. import Types
  10.  
  11. type Image = [Float]
  12. type Sample = (Int, Image)
  13.  
  14. -- execute, por retornar IO, pode interagir chamando outras IO Actions como
  15. -- leitura dos weights, biases e input da Rede, por exemplo.
  16. execute :: IO String -- mero esqueleto da funcao de execucao
  17. execute = return ""
  18.  
  19. -- inicializa a rede com dados previamente salvos,
  20. -- ou aleatorios em caso de primeira execucao.
  21. initialize :: Data
  22. initialize = Data [[]] [] [] [] [[]] [] [] []
  23.  
  24. -- recebe a imagem, a network e computa os calculos,
  25. -- retornando a nova data com os valores de ativacao
  26. -- e zeta do hidden e output alterados.
  27. feedforward :: Image -> Data -> Data
  28. feedforward input network = let zH = (imagem*(wHidden network)) + (bHidden network)
  29.                                 aH = sigmoid zH
  30.                                 zO = (aH*(wOutput network)) + (bOutput network)
  31.                                 aO = sigmoid zO
  32.  
  33.                             in Data (wHidden network) (bHidden network) aH zH (wOutput network) (bOutput network) aO zO
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement