How to get the same output for the same test example provided to the neural network as explained below?

3 views (last 30 days)
Hi everyone,
I'm building a property-rental prediction model using 2-layer BackPropagation neural network. Everything went well. But the net produces different output every time I apply it to the same test example. I'd like to know how can I get consistent results when applying the network on the same test data (using sim function)? I know that it has something to do with the network weights being randomly initialized. However, there must be a way to either initialize the weights to some values or maybe to use another strategy.
Thank you!
Iulia

Accepted Answer

Greg Heath
Greg Heath on 28 Jul 2013
Intialize the random number generator to a specified state before the weights are initialized. For example, rng(0) or rng(1492)
Hope this helps.
Thank you for formally accepting my answer
Greg
P.S. Search rng(0) greg
  1 Comment
Iulia
Iulia on 28 Jul 2013
Thanks Greg. Yes it worked just by adding rand('state',0) But I still wonder if this way is the best. I mean, does the random initialization of weights has better effect on training than static initialization?
Thanks!

Sign in to comment.

More Answers (0)

Categories

Find more on Deep Learning Toolbox in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!