Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

Topic: neural network perceptron cost function
Replies: 2   Last Post: Apr 1, 2013 7:00 AM

 Messages: [ Previous | Next ]
 Greg Heath Posts: 6,387 Registered: 12/7/04
Re: neural network perceptron cost function
Posted: Apr 1, 2013 7:00 AM

"Aaron Williams" wrote in message <h8jleq\$1h7\$1@fred.mathworks.com>...
> When you use the train function in the neural network toolbox, how do you get the cost function from the outputs? Or are there any other ways to get the cost functions for a perceptron using batch learning?
>

[ net tr Y E Xf Af ] = train( net, x, t, Xi, Ai);

Investigate the training record by typing

tr = tr

If training stops because tr.stop = 'Validation set stop.' then tr.best_epoch is
max_fail epochs before the end of training at tr.num_epochs.

MSEtrn = tr.perf(tr.best_epoch)
MSEval = tr.vperf(tr.best_epoch)
MSEtst = tr.tperf(tr.best_epoch)

E = t-Y;
MSEtrn = mse(E(:,tr.trainInd))
MSEval = mse(E(:,tr.valInd)
MSEtst = mse(E(:,tr.testInd)

Watch out for typos because I am writing this using a crumbling 73 year old memory.

Hope this helps.

Greg

Date Subject Author
9/13/09 Aaron Williams