-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathComplexNet.m
More file actions
executable file
·75 lines (46 loc) · 1.89 KB
/
Copy pathComplexNet.m
File metadata and controls
executable file
·75 lines (46 loc) · 1.89 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
classdef ComplexNet
properties
net;
sigma_sq_in;
sigma_sq_out;
t;
X0;
R2;
end
methods
function obj = ComplexNet(N0,N1,N2,g,eta)
obj.net = SimpleNet(N0,N1,N2,g,eta);
obj.t = 1;
obj.sigma_sq_in = ones(N0,1);
obj.sigma_sq_out = ones(N2,1);
end
function obj = FProp(obj,X0)
% Time is update at the beginning of every FProp
obj.t = obj.t + 1;
t = obj.t;
% Divide by standard deviation of inputs
obj.X0 = X0./sqrt(obj.sigma_sq_in);
obj.net = obj.net.FProp(X0);
% Multiply by standard deviation of outputs
obj.R2 = obj.net.R2.*sqrt(obj.sigma_sq_out);
obj.sigma_sq_in = (1/t)*X0.^2 + obj.sigma_sq_in.*(t-1)/t;
end
function R2 = FastProp(obj,X0)
X0 = X0./sqrt(obj.sigma_sq_in);
R2 = obj.net.FastProp(X0).*sqrt(obj.sigma_sq_out);
end
function obj = ErrorLearn(obj,target)
t = obj.t;
delta = target - obj.R2;
delta_net = delta.*sqrt(obj.sigma_sq_out);
obj.net = obj.net.ErrorLearn(delta_net);
obj.sigma_sq_out = (1/t)*target.^2 + obj.sigma_sq_out.*(t-1)/t;
end
function obj = Tag(obj)
obj.net = obj.net.Tag();
end
function obj = Untag(obj)
obj.net = obj.net.Untag();
end
end
end