Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

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


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

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: 5,976
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$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



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

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.