Stopping the neural network by tr.gradient

In training an ANN using FITNET , I noticed , the tr.gradient gives a row matrice that the number of columns are the number of iterations , and the last column is the gradient reported on the train window
I tried doing :
for h=Hmin:dH:Hmax
j = j+1
net = fitnet(10);
net = init(net); % Improving Results since we use patternet we should use init
[ net tr y ] = train( net, x, t );
e = gsubtract(t,y);
performance = perform(net,t,y)
if tr.gradient(end) < 0.05
tr.stop
end
but it only stops the Validation test , not the actual training test , is there a way to do this ? and also when I retrain after a gradient like 0.503 and I get a smaller gradient , if from my outputs one is calculated not so precisely , the only thing happens is that , another output will be unprecise.
I have 8 inputs and 3 outputs

 채택된 답변

Ahmed
Ahmed 2015년 3월 6일

2 개 추천

Maybe you are looking for the property “trainParam.min_grad”.
net = fitnet(10);
net.trainParam.min_grad % default 1e-7
net.trainParam.min_grad = 1e-5;
net.trainParam.min_grad % changed to 1e-5

댓글 수: 7

farzad
farzad 2015년 3월 6일
Yes exactly , but how should I stop the training after comparison ?
Greg Heath
Greg Heath 2015년 3월 6일
It stops automatically.
Why are you not using the default values?
farzad
farzad 2015년 3월 6일
well I didn't know that the default value is 1e-7 , it seemed to me that 1e-5 is the smallest number I have seen on the training while I was following.
is there any way to increase the accuracy of the loop ? only by changing H ? I changed it from 40 to 80, but Hub is 139
farzad
farzad 2015년 3월 6일
Dear Professor , still , with Ntrials = 20 , and as you have mentioned that MATLAB will stop in a very low gradient. I wonder that when I manually check some of my inputs , there is an error as big as integers. sometimes like 8 or 9.
I have found the following usually sufficient
MSEgoal = 0.01*mean(var(target',1))
MinGrad = MSEgoal/100
net.trainParam.goal = MSEgoal;
net.trainParam.min_grad = MinGrad;
Hope this helps.
^Thank you for formally accepting my answer
Greg
farzad
farzad 2015년 3월 11일
Thank you very much dear professor
I wish I could accept ,but it was a comment
Greg Heath
Greg Heath 2015년 3월 15일
Not a problem.
Good Luck
Greg

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Deep Learning Toolbox에 대해 자세히 알아보기

질문:

2015년 3월 6일

댓글:

2015년 3월 15일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by