How to custom the perform function using neural network toolbox?

2 views (last 30 days)
I am using MATLAB R2015a and I would like to train a neural network with my own perform function. I followed all steps described in forums to do it :
1) I copied the mse.m and +mse folder from inside the matlab directory to my working directory and i renamed them as mymse.m and +mymse
2) I modified the function name inside the mymse.m file from:
function perf = mse(net,varargin)
to
function perf = mymse(net,varargin)
then building the net, i added my own performance function as
net.performFcn = 'mymse'
3) I left the .m functions inside the +mymse folder as they are since mymse function computes the mse. Note that I do not change mymse.m as I wish it, before changing the perform function I would like the program works by integrating mymse.m (working exactly like mse.m).
Finally the code doesn't work at all and I don't understand why. The result is always a flatline or crashes.
Could you help me in this task.
Thank you
Vincent

Accepted Answer

Søren Jensen
Søren Jensen on 29 Apr 2015
Im by far not an expert, but here's what i would do:
1) make sure the directory you are working in is the right one
2) try copying your mymse.m files to the original matlab directory.. maybe the net can only search for performance functions here?
I don't know if you if you really need a custom performance function but if you surrender to matlab, here's a list of the premade performance functions:
mae - Mean absolute error performance function.
mse - Mean squared error performance function.
sae - Sum absolute error performance function.
sse - Sum squared error performance function.
  1 Comment
Vincent RICHARD
Vincent RICHARD on 29 Apr 2015
Ok it works! thank you Soren.
I would like now to change the template 'mymse.m' to built my own perform function. The obectif is to optimize the phase error generated by the two outputs of the networks.
Do you have an idea where we have to integrate it in the code 'mymse'?
Thank you in advance
Vincent

Sign in to comment.

More Answers (0)

Categories

Find more on Sequence and Numeric Feature Data Workflows in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!