95 |
The ctor creates the array which stores the last weights modification. |
The ctor creates the array which stores the last weights modification. |
96 |
*) |
*) |
97 |
initializer |
initializer |
98 |
_lastWeightsChange = Array.make (network#getLayerNb - 1) [|[||]|]; |
_lastWeightsChange <- Array.make (network#getLayerNb - 1) [|[||]|]; |
99 |
for i = 0 to network#getLaxyerNb - 2 do |
for i = 0 to network#getLaxyerNb - 2 do |
100 |
network#weights.(i) <- Array.make (network#getNeuronsPerLayer i) [||]; |
network#weights.(i) <- Array.make (network#getNeuronsPerLayer i) [||]; |
101 |
for j = 0 to (network#getNeuronsPerLayer i) - 1 do |
for j = 0 to (network#getNeuronsPerLayer i) - 1 do |
123 |
-. network#getStep *. !gradients.(l).(i).(j) in |
-. network#getStep *. !gradients.(l).(i).(j) in |
124 |
(** Store the correction we are about to apply for next |
(** Store the correction we are about to apply for next |
125 |
time... *) |
time... *) |
126 |
_lastWeightsChange.(l).(i).(j) = weightCorrection; |
_lastWeightsChange.(l).(i).(j) <- weightCorrection; |
127 |
(** ...then apply the weigh correction. *) |
(** ...then apply the weigh correction. *) |
128 |
!weights.(l).(i).(j) <- !weights.(l).(i).(j) +. weightCorrection |
!weights.(l).(i).(j) <- !weights.(l).(i).(j) +. weightCorrection |
129 |
done |
done |