필터 지우기
필터 지우기

In Neural Network Toolbox, how can I can change the values of training Parameters ?

조회 수: 51 (최근 30일)
For example, in the example "Iris Flowers" dataset in "Neural Net Pattern Recognition" App,default training function is trainscg.I want to use another training function which will use learning rate, lr, and momentum constant, mc.Also i want to change values of learning rate, lr, and momentum constant parameters.
  댓글 수: 2
Greg Heath
Greg Heath 2016년 11월 7일
Why in the world would you want to make those changes for a classification/patternrecognition problem?
Greg
pichapong phantukup
pichapong phantukup 2018년 4월 28일
I have a problem about percentage of errors.Can you help me ?

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

채택된 답변

mizuki
mizuki 2016년 11월 7일
You cannot customize a lot with App. If you want to train not with default values, change values/parameters on code.
After the training on Neural Pattern Recognition App, click Next until getting to the Save Results page.
Click "Simple Script."
When you want to use the training function that uses learning rate and momentum, use traingdx. (If it is only learning rate, use traingda; if it is only momentum, use traingdm)
In the generated script, there is a line defining the training function such as:
>> trainFcn = 'trainscg';
Change this to, for example:
>> trainFcn = 'traingdx';
If you want to change the parameter of learning rate to 0.1 for example, add
>> net.trainParam.lr = 0.1;
after making the default network, which is the line include PATTERNNET as well as before TRAIN. You can also change the momentum by changing net.trainParam.mc.
  댓글 수: 2
Machine Learning Enthusiast
Machine Learning Enthusiast 2016년 11월 7일
Dear mizuki,Thanks for brilliant answer.I tried your steps,but when i replace trainscg with traingdx,it still trains the data with trainscg as shown in below image
:
x = csvread('irisInputs.csv');
t = csvread('irisTargets.csv');
trainFcn = 'traingdx';
% Create a Pattern Recognition Network
hiddenLayerSize = 10;
net = patternnet(hiddenLayerSize);
% Setup Division of Data for Training, Validation, Testing
net.divideParam.trainRatio = 70/100;
net.divideParam.valRatio = 15/100;
net.divideParam.testRatio = 15/100;
% Train the Network
[net,tr] = train(net,x,t);
% Test the Network
y = net(x);
e = gsubtract(t,y);
performance = perform(net,t,y)
tind = vec2ind(t);
yind = vec2ind(y);
percentErrors = sum(tind ~= yind)/numel(tind);
% View the Network
view(net)
NN
NN 2020년 10월 27일
Hi, i also have the same issue, getting high error .So i tried the above method.but i am getting the error when i changed trainlm to traindx.
Error using fitnet (line 73)
FCN is not the name of a function on the MATLAB path.
kindly advice

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

추가 답변 (2개)

mizuki
mizuki 2016년 11월 7일
How about using
>> net = patternnet(hiddenLayerSize, trainFcn);
instead of
>> net = patternnet(hiddenLayerSize);
  댓글 수: 1
Machine Learning Enthusiast
Machine Learning Enthusiast 2016년 11월 8일
works like a charm.Thanks to you. what would be the ideal values for Learning rate and momentum while training data? Should we select randomly to check the best fit ?

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


Greg Heath
Greg Heath 2016년 11월 9일
1. Another way to do it is
net = patternnet(hiddenlayersize);
. . .
net.trainFcn = 'traingdx';
[ net tr y e ] = train(net,x,t);
Hope this helps.
Thank you for formally accepting my answer
Greg
  댓글 수: 2
Machine Learning Enthusiast
Machine Learning Enthusiast 2016년 11월 10일
works like a charm.Thanks to you. what would be the ideal values for Learning rate and momentum while training data? Should we select randomly to check the best fit ?
Greg Heath
Greg Heath 2016년 11월 10일
Typically, I have always relied on default values except
1. No of hidden nodes
2. Fixed initial weights
3. MSE goal (I use either 1% (fitnet/patternnet) or 0.1% (timeseries) of the average biased target variance
MSE00 = mean(var(target',1))
In particular, I have not found it necessary to change either learning or momentum.
Hope this helps.
Thank you for formally accepting my answer
Greg

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

카테고리

Help CenterFile Exchange에서 Pattern Recognition and Classification에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by