How can I pass the performance parameters to my own custom performance function in the Neural Network Toolbox?

2 views (last 30 days)

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 18 Oct 2013
For releases of MATLAB prior to MATLAB 8.0 (R2012b), the MSEREG function within the Neural Network Toolbox is a good example of a performance function using the performance parameters.
1) The custom performance function should have a header that looks like:
function perf= myperfFcn(e, x, pp)
where:
E - Matrix or cell array of error vector(s).
X - Vector of all weight and bias values.
PP - Performance parameter structure.
2) To specify your custom performance function:
net.performFcn = 'myperfFcn'
3) To specify your custom performance parameters:
perfStruct.varA = 1;
perfStruct.varB = 2;
net.performParam = perfStruct;
Note the "net" structure will now include:
    parameters:
         adaptParam: .passes
         initParam: (none)
         performParam: .varA, .varB
For releases of MATLAB starting in MATLAB 8.0 (R2012b), information is provided by the command,
>> help nncustom
For example, to specify a custom performance function, execute the command,
>> which mse
to locate the 'mse' function.  Copy and rename the file 'mse.m' and the folder '+mse'.  Then, use these functions as templates to write your own custom function.

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!