-
Notifications
You must be signed in to change notification settings - Fork 10
/
update_step_size.m
36 lines (32 loc) · 1.25 KB
/
update_step_size.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
function [mynet step_size]=update_step_size(mynet,error_array,iter,step_size,decrease_rate, increase_rate)
%% written by Muhammet Balcilar, France
% all rights reserved
if check_decrease_ss(error_array, mynet.last_decrease_ss, iter)
step_size = step_size*decrease_rate;
mynet.last_decrease_ss = iter;
elseif check_increase_ss(error_array, mynet.last_increase_ss, iter)
step_size = step_size*increase_rate;
mynet.last_increase_ss = iter;
end
function sts=check_decrease_ss(error_array, last_change, current)
if (current - last_change < 4)
sts=false;
elseif ((error_array(current) < error_array(current - 1)) && ...
(error_array(current - 1) > error_array(current - 2)) && ...
(error_array(current - 2) < error_array(current - 3)) && ...
(error_array(current - 3) > error_array(current - 4)))
sts=true;
else
sts=false;
end
function sts=check_increase_ss(error_array, last_change, current)
if (current - last_change < 4)
sts=false;
elseif ((error_array(current) < error_array(current - 1)) && ...
(error_array(current - 1) < error_array(current - 2)) && ...
(error_array(current - 2) < error_array(current - 3)) && ...
(error_array(current - 3) < error_array(current - 4)))
sts=true;
else
sts=false;
end