/[marvin]/marvin/src/libnn/errorCommonVisitor.ml
ViewVC logotype

Diff of /marvin/src/libnn/errorCommonVisitor.ml

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.4 by matthieu, Thu Jul 17 23:38:06 2003 UTC revision 1.5 by matthieu, Tue Jul 22 08:44:16 2003 UTC
# Line 61  object Line 61  object
61        output = network#getOutputLearnVector and        output = network#getOutputLearnVector and
62        outputActivation = network#getOutputActivation and        outputActivation = network#getOutputActivation and
63        inputSum = network#getInputSum and        inputSum = network#getInputSum and
64        weights = network#getWeights in        weights = network#getWeights and
65          derivate = _derivateFunction in
66        begin        begin
67          (**          (**
68            Compute the error of the output layer            Compute the error of the output layer
69          *)          *)
70          for i = 0 to (Array.length !error.(network#getLayerNb - 1)) - 1 do          for i = 0 to (Array.length !error.(network#getLayerNb - 1)) - 1 do
71            !error.(network#getLayerNb - 1).(i)            !error.(network#getLayerNb - 1).(i)
72            <- output.(i) -. !outputActivation.(network#getLayerNb - 1).(i)            <- derivate(!inputSum.(network#getLayerNb - 1).(i))
73              *. (output.(i) -. !outputActivation.(network#getLayerNb - 1).(i))
74          done;          done;
75          (**          (**
76            Compute the error and gradient of the hidden layers.            Compute the error and gradient of the hidden layers.
# Line 79  object Line 81  object
81              for j = 0 to (Array.length !error.(l + 1)) - 1 do              for j = 0 to (Array.length !error.(l + 1)) - 1 do
82                !error.(l).(i)                !error.(l).(i)
83                <- !error.(l).(i)                <- !error.(l).(i)
84                +. !error.(l + 1).(j) *. _derivateFunction(!inputSum.(l + 1).(j))                +. !error.(l + 1).(j) *. derivate(!inputSum.(l + 1).(j))
85                *. !weights.(l).(i).(j);                *. !weights.(l).(i).(j);
86    
87                !gradients.(l).(i).(j)                !gradients.(l).(i).(j)
88                <- !error.(l + 1).(j) *. _derivateFunction(!inputSum.(l).(i))                <- !error.(l + 1).(j) *. !outputActivation.(l).(i)
               *. !outputActivation.(l).(i)  
89              done              done
90            done            done
91          done          done

Legend:
Removed from v.1.4  
changed lines
  Added in v.1.5

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26