フィルターのクリア

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

6 ビュー (過去 30 日間)
Surae
Surae 2011 年 7 月 29 日
回答済み: Greg Heath 2018 年 2 月 3 日
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

Community Treasure Hunt

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

Start Hunting!

Translated by