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

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

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

revision 1.4 by matthieu, Tue Jul 15 16:31:57 2003 UTC revision 1.5 by matthieu, Thu Jul 17 00:06:55 2003 UTC
# Line 51  open CommonNN Line 51  open CommonNN
51  class propagateCommonVisitor =  class propagateCommonVisitor =
52  object  object
53    inherit [commonNN] propagateVisitor    inherit [commonNN] propagateVisitor
54    method visitCommon (network : commonNN) = ()    val mutable _transfertFunction = function x -> (1. /. (1. +. exp (-.x)))
55      method visitCommon (network : commonNN) =
56        let step = network#getStep and
57        transFun = _transfertFunction and
58        outputActivation = network#getOutputActivation and
59        inputSum = network#getInputSum and
60        weights = network#getWeights in
61          begin
62            (**
63              Activation of the input layer.
64            *)
65            for i = 0 to (network#getNeuronsPerLayer 0) - 1 do
66              !outputActivation.(0).(i) <- transFun !inputSum.(0).(i)
67            done;
68            (**
69              Propagation of the activation.
70              //FIXME step handling
71            *)
72            for l = 1 to network#getLayerNb - 1 do
73              for i = 0 to (network#getNeuronsPerLayer l) - 1 do
74                !inputSum.(l).(i) <- !outputActivation.(l - 1).(0)
75                *. !weights.(l - 1).(i).(0);
76                for j = 1 to (network#getNeuronsPerLayer (l - 1)) - 1 do
77                  !inputSum.(l).(i) <- !inputSum.(l).(i)
78                  +. !outputActivation.(l - 1).(j)
79                  *. !weights.(l - 1).(i).(j)
80                done;
81                !outputActivation.(l).(i) <- transFun !inputSum.(l).(i)
82              done
83            done
84          end
85  end  end

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