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

조회 수: 13 (최근 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

카테고리

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