The Math Forum

Search All of the Math Forum:

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

Math Forum » Discussions » Software » comp.soft-sys.matlab

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

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   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
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

"Aaron Williams" wrote in message <h8jleq$1h7$>...
> 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.


Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© The Math Forum at NCTM 1994-2018. All Rights Reserved.