forked from mikhailpt/smartpid-toolbox-matlab
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtrainSmartPIDoutFn.m
40 lines (32 loc) · 1.08 KB
/
trainSmartPIDoutFn.m
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
function stop = trainSmartPIDoutFn(W,optimValues,state,app)
stop = app.stop;
switch state
case 'init'
disp('init')
case {'iter','interrupt'}
disp(['iter','interrupt'])
ind = 1;
%Layer1
for i = 1:app.layer1Sz
app.net2.IW{1,1}(i,:)=W(ind:ind+app.inpSz-1);ind=ind+app.inpSz;
end
app.net2.b{1}=W(ind:ind+app.layer1Sz-1)';ind=ind+app.layer1Sz;
%Layer2
app.net2.LW{2,1}(1,:)=W(ind:ind+app.layer1Sz-1);ind=ind+app.layer1Sz;
app.net2.LW{2,1}(2,:)=W(ind:ind+app.layer1Sz-1);ind=ind+app.layer1Sz;
app.net2.LW{2,1}(3,:)=W(ind:ind+app.layer1Sz-1);ind=ind+app.layer1Sz;
app.net2.b{2,1}=W(ind:ind+3-1)';
if app.inpSz == 1
disp(app.net2(0))
elseif app.inpSz == 2
disp(app.net2([0; 50]))
end
if app.SEEDsw == 1
app.SEED=floor(rand * 10000);
fprintf('set SEED=%d\n', app.SEED);
end
app.Counter = 0;
app.reverseStr = '';
case 'done'
disp('done')
end