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

13 次查看(过去 30 天)
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.

回答(3 个)

Fangjun Jiang
Fangjun Jiang 2011-7-29
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 个评论
Salma Hassan
Salma Hassan 2018-2-2
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

请先登录,再进行评论。


Daniel Shub
Daniel Shub 2011-7-29

Greg Heath
Greg Heath 2018-2-3
Read the documentation in
help rand
and
doc rand
Hope this helps.
Thank you for formally accepting my answer
Greg

类别

Help CenterFile Exchange 中查找有关 Sequence and Numeric Feature Data Workflows 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by