How to customize performance function in MATLAB neural network.

6 views (last 30 days)
Greetings. I am relatively a beginner in neural network. I started off using MATLAB neural network tool until I was met with some limitations. My problem is as follows: 1.) I would like to be able to customize my performance function such that I don't use the inbuilt performance functions such as mse, mae, etc. 2.) I would also like to be able to modify how many training iteration before any validation. I read somewhere that it takes five (5) training iteration before every consecutive validation check. However, if someone has an idea of a better neural network tool that is good for function approximation using MLP, please recommend.
Thank you.

Answers (1)

Greg Heath
Greg Heath on 22 Apr 2015
1. Start with a copy of mse (or other performance function)
a. Enter the command: type mse
b. Copy and save the result under a different name, e.g., myperf
c. Modify it
d. Save it
e. Change the net property
net.perfornFcn = myperf;
f. Test it.
2. net.trainParam.max_fail = 10; %(or whatever)
3. Enter WITHOUT THE SEMICOLON!
net = fitnet
You will see a long list of default parameters that can be changed to your liking.
Hope this helps.
Thank you for formally accepting my answer
Greg
PS: This is explained in the website documentation section on custom functions.
  3 Comments
Arygianni Valentino
Arygianni Valentino on 1 Dec 2017
Hi Greg..
If you do not mind, would you explain more and give an example of the step Modify the performance function? Since I got stuck there. I could not find the formula where the corresponding performance function does the calculation.
Chibuzo Nnonyelu
Chibuzo Nnonyelu on 14 Jan 2018
This approach did not actually work. I ended up writing my own MLP BP from scratch using C#. C# ensured faster training with larger data. And I was able to try my custom error and performance function.
Using MATLAB for ANN is only good if you are just fine with its available functions and all.

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!