Effacer les filtres
Effacer les filtres

How I can use rand('seed', ??) for neural network model?

6 vues (au cours des 30 derniers jours)
Surae
Surae le 29 Juil 2011
Hi,
I'm using 'newfftd' which is neural network time delayed model, and I have no idea how I can use rand('seed', ??) for the neural network model? Here is my partial codes of rand('seed').
numDelays = 3;
rand('seed',1);
net = newfftd(P,T,0:numDelays,[20 8],{'logsig' 'logsig' 'purelin'}, 'traincgb', 'learngdm', 'msereg');
net = init(net)
However, I have no idea what the number of '1' means and how it can be scalable?
I found that I got different forecast performance when I changed the number by increasing 1 to 10.
Do I need to find the number while increase until I get a good forecasted result?
Thanks a lot for your reply in advance.

Réponses (3)

Fangjun Jiang
Fangjun Jiang le 29 Juil 2011
Every time you use rand(), it gives you a random number, that is what rand() is for. But what if you want to repeat that random number, for the purpose of duplicate your simulation results? That is when rand('seed',n) is useful. It gives you a way to generate rand numbers but repeatable. Try the following to see those rand numbers be repeated, also type "doc rand" for more info. rand('seed',n) where n is used to identify or specify a particular series.
clear all;
rand(1,3)
rand('seed',1);rand(1,3)
rand(1,3)
rand('seed',1);rand(1,3)
  1 commentaire
Salma Hassan
Salma Hassan le 2 Fév 2018
what is the different between using n=1 or n=0 , and what about this https://www.mathworks.com/matlabcentral/answers/72733-random-numbers-seed-setting#answer_82791
a=rng;
out=randn
rng(a)
out=randn

Connectez-vous pour commenter.


Daniel Shub
Daniel Shub le 29 Juil 2011

Greg Heath
Greg Heath le 3 Fév 2018
Read the documentation in
help rand
and
doc rand
Hope this helps.
Thank you for formally accepting my answer
Greg

Community Treasure Hunt

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

Start Hunting!

Translated by