In Neural Network Toolbox, how can I can change the values of training Parameters ?
15 次查看(过去 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
2016-11-7
Why in the world would you want to make those changes for a classification/patternrecognition problem?
Greg
采纳的回答
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.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/175433/image.png)
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 个评论
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
2016-11-7
How about using
>> net = patternnet(hiddenLayerSize, trainFcn);
instead of
>> net = patternnet(hiddenLayerSize);
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 个评论
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
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!