How can i change performFcn of neural network training?

59 views (last 30 days)
When i try it the obvious way the change is ignored,
>> net = feedforwardnet(20);
>> net.performFcn='msereg';
>> net.performFcn
ans =
mse
Also i've noticed that changing parameters in net.trainParam is completely ignored in latter call of train function
>> net = feedforwardnet(20);
>> matlabpool open
>> net.trainParam.epochs = 130;
>> net.trainParam
ans =
(...)
Maximum Epochs epochs: 130
>> net=train(net,WE2,WY2, 'useParallel','yes','useGPU','yes');
NOTICE: Jacobian training not supported on GPU. Training function set to TRAINSCG.
Lab 1:
Training with TRAINSCG.
Epoch 0/1000, (...)
As u can see the epoch limit didn't actually change. What am I doing wrong, and how to do it properly?
*im using matlab r2012b

Accepted Answer

Greg Heath
Greg Heath on 24 Nov 2012
>> net = feedforwardnet(20);
>> net.performFcn='msereg';
>> net.performFcn
ans =
msereg
1. Don't know what caused your error.
2. I cannot help with other problem
Sorry,
Greg
  3 Comments
Neelabh Jyoti Saharia
Neelabh Jyoti Saharia on 13 Dec 2021
Hi Greg, my problem is kind of similar with this. I want to create a feedforwardnet and then train it using a custom made loss function.
For that, can I create a matlab function, function loss = custom_loss(y,x). And then put net.performFcn = 'custom_loss'.
Other thing remains same as in the default feedforward.

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!