37 |
|
|
38 |
(** |
(** |
39 |
The errorCommonVisitor class |
The errorCommonVisitor class |
40 |
|
Computes each neurone's output error. |
41 |
|
|
42 |
@author Matthieu Lagacherie |
@author Matthieu Lagacherie |
43 |
@author Olivier Ricordeau |
@author Olivier Ricordeau |
52 |
class errorMlpnnVisitor = |
class errorMlpnnVisitor = |
53 |
object |
object |
54 |
inherit [mlpNN] errorVisitor |
inherit [mlpNN] errorVisitor |
55 |
|
|
56 |
val mutable _transfertFunction = function x |
val mutable _transfertFunction = function x |
57 |
-> (1. /. (1. +. exp (-.x))) |
-> (1. /. (1. +. exp (-.x))) |
58 |
|
|
59 |
val mutable _derivateFunction = function x |
val mutable _derivateFunction = function x |
60 |
-> (((1. /. (1. +. exp (-.x)))) *. (1. -. (1. /. (1. +. exp (-.x))))) |
-> (((1. /. (1. +. exp (-.x)))) *. (1. -. (1. /. (1. +. exp (-.x))))) |
61 |
|
|
62 |
method visitMlpnn (network : mlpNN) = |
method visitMlpnn (network : mlpNN) = |
63 |
let error = network#getError and |
let error = network#getError and |
64 |
gradients = network#getGradients and |
gradients = network#getGradients and |
86 |
!error.(l).(i) |
!error.(l).(i) |
87 |
<- !error.(l).(i) |
<- !error.(l).(i) |
88 |
+. !error.(l + 1).(j) *. !weights.(l).(i).(j); |
+. !error.(l + 1).(j) *. !weights.(l).(i).(j); |
|
|
|
89 |
!gradients.(l).(i).(j) |
!gradients.(l).(i).(j) |
90 |
<- !error.(l + 1).(j) *. !outputActivation.(l).(i) |
<- !error.(l + 1).(j) *. !outputActivation.(l).(i) |
91 |
done; |
done; |