52 |
class propagateTdnnVisitor = |
class propagateTdnnVisitor = |
53 |
object |
object |
54 |
inherit [tdNN] propagateVisitor |
inherit [tdNN] propagateVisitor |
|
|
|
|
initializer |
|
|
_moduleName <- "TDNN propagation" |
|
|
|
|
55 |
val mutable _transfertFunction = function x -> (1. /. (1. +. exp (-.x))) |
val mutable _transfertFunction = function x -> (1. /. (1. +. exp (-.x))) |
|
|
|
56 |
method visit (network : tdNN) = |
method visit (network : tdNN) = |
57 |
let step = network#getStep and |
let step = network#getStep and |
58 |
transFun = _transfertFunction and |
transFun = _transfertFunction and |
59 |
outputActivation = network#getOutputActivation and |
outputActivation = network#getOutputActivation and |
60 |
inputSum = network#getInputSum and |
inputSum = network#getInputSum and |
61 |
weights = network#getWeights and |
weights = network#getWeights and |
62 |
delay = network#getDelay and |
delay = network#getDelay and |
63 |
stepDelay = ref 0 in |
stepDelay = ref 0 in |
64 |
begin |
begin |
65 |
(** |
(** |
66 |
Activation of the input layer. |
Activation of the input layer. |
67 |
*) |
*) |
68 |
for i = 0 to (network#getFeaturesNb.(0)) - 1 do |
for i = 0 to (network#getFeaturesNb 0) - 1 do |
69 |
for j = 0 to (network#getTimeNb.(0)) - 1 do |
for j = 0 to (network#getTimeNb 0) - 1 do |
70 |
!outputActivation.(0).(i).(j) <- transFun !inputSum.(0).(i).(j) |
!outputActivation.(0).(i).(j) <- transFun !inputSum.(0).(i).(j) |
71 |
done |
done |
72 |
done; |
done; |
80 |
stepDelay used to keep the delay concept |
stepDelay used to keep the delay concept |
81 |
*) |
*) |
82 |
for l = 0 to network#getLayerNb - 2 do |
for l = 0 to network#getLayerNb - 2 do |
83 |
for i = 0 to (network#getFeaturesNb.(l + 1)) - 1 do |
for i = 0 to (network#getFeaturesNb (l + 1)) - 1 do |
84 |
for j = 0 to (network#getTimeNb.(l + 1)) - 1 do |
for j = 0 to (network#getTimeNb (l + 1)) - 1 do |
85 |
!inputSum.(l + 1).(i).(j) <- 0.; |
!inputSum.(l + 1).(i).(j) <- 0.; |
86 |
for k = 0 to (network#getFeaturesNb.(l)) - 1 do |
for k = 0 to (network#getFeaturesNb l) - 1 do |
87 |
for m = !stepDelay to (!stepDelay + !delay.(l)) - 1 do |
for m = !stepDelay to (!stepDelay + !delay.(l)) - 1 do |
88 |
!inputSum.(l + 1).(i).(j) <- !inputSum.(l + 1).(i).(j) |
!inputSum.(l + 1).(i).(j) <- !inputSum.(l + 1).(i).(j) |
89 |
+. !outputActivation.(l).(k).(l + !stepDelay) |
+. !outputActivation.(l).(k).(l + !stepDelay) |
98 |
stepDelay := 0 |
stepDelay := 0 |
99 |
done |
done |
100 |
end |
end |
|
|
|
101 |
end |
end |