Search code examples
matlabvalidationneural-networkgradient-descentmean-square-error

Netlab - How are the errors calculated?


I'm trying to optimise and validate a neural network using Netlab on Matlab

I'd like to find the error value for each iteration, so I can see convergence on a plot. This can be done by storing the errors presented in the command window which is done by setting options(1) to 1 using errlog is a netopt output.

However these errors are not the same as mlperr which gives an error value of 0.5*(sum of squares error) for the last iteration. I can't really validly use them if I don't know how they're calculated.

Does anybody know what the errors displayed in the command window represent (I'm using scaled conjugate gradient as my optimisation algorithm)?

Is there a way of storing the mlperr for each iteration that the network runs?

Any help is greatly appreciated, many thanks!

NB: I have tried doing something similar to this : ftp://ftp.dcs.shef.ac.uk/home/spc/com336/neural-lab-wk6.html

However it gives different results to running the network with the number of iterations specified under options(14) rather than k for some reason.


Solution

  • Yes certainly,

    The ERRLOG vector, created as an output to the network optimisation function netopt with the following syntax

    [NET, OPTIONS, ERRLOG] = netopt(NET, OPTIONS, X, T, ALG)
    

    Each row of ERRLOG gives 0.5*SSE (sum of squares error) for the corresponding iteration of network optimisation. This error is calculated between the predicted outputs (y) and the target outputs (t).

    The MLPERR function, hast the following syntax

    E = mlperr(NET, X, T)
    

    It also gives 0.5*SSE between predicted outputs (y) and target outputs (t), but as the network parameters are constant (NET should be pre-trained), E is a singular value.

    If netopt was run with an ERRLOG output, and then MLPERR was run with the same network and variables, E should be the same value as value of the final row of ERRLOG (the error after the final iteration of network optimisation).

    Hope this is of some use to someone!