Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
Neural Network Fitting Tool varying performance

Subject: Neural Network Fitting Tool varying performance

From: jrockv6e

Date: 17 Jun, 2011 14:17:04

Message: 1 of 7

Hi, I'm using the Neural Network Fitting Tool in Matlab R2010b. I'm loading the built-in example data set "House Pricing" using GUI to create a feedforward network with the default settings.

I have the following question.

Since the initial network configuration (initial conditions and sampling) is random (by Nguyen-Widrow method) the performance of the network varies every time it is trained.

How can I compare the performance of the network when I change the # of neurons in the hidden layer if the MSE always varies, even when keeping the hidden neurons to 10?

Thanks in advance!

Subject: Neural Network Fitting Tool varying performance

From: jrockv6e

Date: 17 Jun, 2011 16:38:05

Message: 2 of 7

anyone? any hints or place where I can find this answer? Thanks

Subject: Neural Network Fitting Tool varying performance

From: Steven_Lord

Date: 17 Jun, 2011 17:26:49

Message: 3 of 7



"jrockv6e " <jrockv6e@gmail.com> wrote in message
news:itfvtd$hmd$1@newscl01ah.mathworks.com...
> anyone? any hints or place where I can find this answer? Thanks

1) Capture the state of the random number generator.

2) While you still have tests to run
    2a) Run your test.
    2b) Restore the state of the random number generator to the state
captured in step 1.

http://www.mathworks.com/help/techdoc/math/example-demos-rngdemo.html

--
Steve Lord
slord@mathworks.com
To contact Technical Support use the Contact Us link on
http://www.mathworks.com

Subject: Neural Network Fitting Tool varying performance

From: jrockv6e

Date: 21 Jun, 2011 22:43:02

Message: 4 of 7

"Steven_Lord" <slord@mathworks.com> wrote in message <itg2oq$q9m$1@newscl01ah.mathworks.com>...
>
>
> "jrockv6e " <jrockv6e@gmail.com> wrote in message
> news:itfvtd$hmd$1@newscl01ah.mathworks.com...
> > anyone? any hints or place where I can find this answer? Thanks
>
> 1) Capture the state of the random number generator.
>
> 2) While you still have tests to run
> 2a) Run your test.
> 2b) Restore the state of the random number generator to the state
> captured in step 1.
>
> http://www.mathworks.com/help/techdoc/math/example-demos-rngdemo.html
>
> --
> Steve Lord
> slord@mathworks.com
> To contact Technical Support use the Contact Us link on
> http://www.mathworks.com

Thanks Steve, I think this only works for Matlab 2011, I've been looking for ways to reset the random number generator in Matlab 2010, but I can't seem to find a function such as rng. Any idea on how to approach this with the 2010 version. Thanks.

Subject: Neural Network Fitting Tool varying performance

From: jrockv6e

Date: 21 Jun, 2011 22:49:04

Message: 5 of 7

"jrockv6e" wrote in message <itr6pm$4ki$1@newscl01ah.mathworks.com>...
> "Steven_Lord" <slord@mathworks.com> wrote in message <itg2oq$q9m$1@newscl01ah.mathworks.com>...
> >
> >
> > "jrockv6e " <jrockv6e@gmail.com> wrote in message
> > news:itfvtd$hmd$1@newscl01ah.mathworks.com...
> > > anyone? any hints or place where I can find this answer? Thanks
> >
> > 1) Capture the state of the random number generator.
> >
> > 2) While you still have tests to run
> > 2a) Run your test.
> > 2b) Restore the state of the random number generator to the state
> > captured in step 1.
> >
> > http://www.mathworks.com/help/techdoc/math/example-demos-rngdemo.html
> >
> > --
> > Steve Lord
> > slord@mathworks.com
> > To contact Technical Support use the Contact Us link on
> > http://www.mathworks.com
>
> Thanks Steve, I think this only works for Matlab 2011, I've been looking for ways to reset the random number generator in Matlab 2010, but I can't seem to find a function such as rng. Any idea on how to approach this with the 2010 version. Thanks.

I got it to work with.

rng = RandStream.getDefaultStream;
rng.reset(your_seed_number)

Thanks!

Subject: Neural Network Fitting Tool varying performance

From: Greg Heath

Date: 22 Jun, 2011 07:12:10

Message: 6 of 7

On Jun 17, 12:38 pm, "jrockv6e " <jrock...@gmail.com> wrote:
> anyone? any hints or place where I can find this answer? Thanks

1. Initialize rand using an integer state

   rand('state', state0) % 1 <= state0 <= 2^31

2. Set a training goal, e.g.,

   MSEgoal = 0.01*(Neq-Nw)*mean(var(ttrn'))/Neq

3. Perform a double loop over the number of hidden nodes, H,
   using, Ntrials weight initialization trials for each value of H.

4. Design and train a net and tabulate the degree-of-freedom
   bias-adjusted training set performance measure
   MSEtrna(H,ntrial) and/or the corresponding validation
   set performance measure MSEval(H,Ntrial)

5. Choose the best performance from the table and
    redesign the best net by keeping track of how many
    designs (and rand calls) were created before the best
    design.

Details can be found in previous posts. Use Google
Groups and sort by date:

heath Neq Nw Ntrials

Hope this helps.

Greg

Subject: Neural Network Fitting Tool varying performance

From: Greg Heath

Date: 22 Jun, 2011 07:39:16

Message: 7 of 7

On Jun 22, 3:12 am, Greg Heath <he...@alumni.brown.edu> wrote:
> On Jun 17, 12:38 pm, "jrockv6e " <jrock...@gmail.com> wrote:
>
> > anyone? any hints or place where I can find this answer? Thanks
>
> 1. Initialize rand using an integer state
>
>    rand('state', state0)       % 1 <= state0 <= 2^31

Or, initialize one of the new RNGs.

2. Calculate the number of training equations obtained
    from a net with O outputs and trained by Ntrn input/output
    training pairs of dimensionality I and O, respectively

    Neq = Ntrn*O

3. Perform a double loop over the number of hidden nodes, H,
    using, Ntrials weight initialization trials for each value of H.

4. For each value of H calculate the number of unknown
    weights and set a degree-of-freedom bias-adjusted
    training goal, e.g.,

    Nw = (I+1)*H+(H+1)*O % I = input dimension

    MSEagoal = 0.01*(Neq-Nw)*mean(var(ttrn'))/Neq

   % ttrn = target matrix of size [O Ntrn]

> 4. Design and train a net and tabulate the degree-of-freedom
>    bias-adjusted training  set performance measure
>    MSEtrna(H,ntrial)  and/or the corresponding  validation
>    set performance measure MSEval(H,Ntrial)
>
> 5. Choose the best performance from the table and
>     redesign the best net by keeping track of how many
>     designs (and rand calls) were created before the best
>     design.
>
> Details can be found in previous posts. Use Google
> Groups and sort by date:
>
> heath Neq Nw Ntrials

Alternatively, you can stop training within the outer loop
when the current best design acheives the training goal.


Hope this helps.

Greg

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us