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: ga optimization of nn weights
Replies: 5   Last Post: Feb 8, 2013 9:47 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,978
Registered: 12/7/04
Re: ga optimization of nn weights
Posted: Feb 8, 2013 9:47 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

"Syed Amin" wrote in message <kf0fr6$j42$1@newscl01ah.mathworks.com>...
> "Greg Heath" <heath@alumni.brown.edu> wrote in message <keuvns$suc$1@newscl01ah.mathworks.com>...
> > ...
> > > function mse_calc = mse_test(x, net, inputs, targets)
> > > % 'x' contains the weights and biases vector
> > > % in row vector form as passed to it by the
> > > % genetic algorithm. This must be transposed
> > > % when being set as the weights and biases
> > > % vector for the network.
> > > % To set the weights and biases vector to the
> > > % one given as input
> > > net = setwb(net, x);
> > > % To evaluate the ouputs based on the given
> > > % weights and biases vector
> > > y = net(inputs);
> > > % Calculating the mean squared error
> > > mse_calc = sum((y-targets).^2)/length(y);

> >
> > No. This is only valid for vectors. For matrices
> > there are many equivalent forms
> >
> > Neq = prod(size(targets))
> > e = targets - y;
> >
> > MSE = sum(sum(e.^2))/Neq
> > MSE = sumsqr(e)/Neq
> > MSE = sse(e)/Neq
> > MSE = mse(e)
> >
> > There are several ways to mitigate overfitting,
> >
> > 1. Reduce H so that Neq >>Nw. An adequate value of r = Neq/Nw depends on the data.
> > 2. Adjust MSE above by replacing Neq with Ndof = Neq - Nw, the number of degrees of freedom for estimation.
> > 3. Use a holdout (from training) validation subset to stop the minimization of MSEtrn when MSEval is a minimum.
> > 4. Use regularization with the modified MSE
> >
> > MSEreg = MSE + alpha*mse(x)
> >
> > I don't remember how alpha is determined. Check the source codes of msereg and
> > trainbr; e.g.,
> >
> > help msereg
> > doc msereg
> > type msereg
> >
> > Hope this helps.
> >
> > Greg
> >
> >
> >
> >
> > Thanks Greg,

> It worked quite well .Now that I have optimized the weights could you tell me how to use these optimized weights to train neural network or patternnet
>


I don't understand. Optimizing the weights IS the training. All that is left is to put them in the net using setwb or net.IW, net.LW and net.b.

Or am I missing something?

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.