-2

Is there any rule of thumb as what to select for fixed seed in RandStream in MATLAB? I am using it for randomly picking samples in 10 split linear discriminant analysis and depending on what I select for seed, I get quite diffent LDA_CCR_mean values (here CCR stands for correct classification rate and LDA_CCR_mean is mean value of CCR across 10 splits).

s = RandStream('mt19937ar','Seed', split*2);

Additionally, I chose mt19937ar based on the first example on RandStream documentation. How do I know what other value should be chosen? Or what value will serve best for my application/algorithm?

Mona Jalal
  • 34,860
  • 64
  • 239
  • 408
  • I am wondering if this is not a question for [CrossValidated](https://stats.stackexchange.com/) or [DataScience](https://datascience.stackexchange.com/) SO forum... – sophros Feb 19 '18 at 19:07

1 Answers1

2

The best choice for a seed value basically depends on whether or not you want to reproduce the same exact results while still using "random" data.

A given random number generator, when started from a given seed s, will always produce the same sequence of values. Let's say you tested an algorithm by feeding it some randomly-generated values. If you change the algorithm, but want to test the new version on the exact same set of input data, you will need to set the random number generator to the same seed that was used the first time so you produce the same sequence of values. By default RandStream will use 0 as the seed, so reinitializing the stream will set it back to the same seed. You could also set it to whatever fixed value you wanted between 0 and 232 − 1.

Alternatively, if you want to create a stream that always starts with a different seed, you can use the 'shuffle' option to create a seed based on the current time:

s = RandStream('mt19937ar', 'Seed', 'shuffle');
gnovice
  • 125,304
  • 15
  • 256
  • 359