フィルターのクリア

y = randsample(population,k)

5 ビュー (過去 30 日間)
riad didou
riad didou 2020 年 8 月 12 日
編集済み: Bruno Luong 2020 年 8 月 12 日
Please, I need to know the name of algorithm used by MATLAB 'randsample' function for the random selection without replacement
  3 件のコメント
riad didou
riad didou 2020 年 8 月 12 日
編集済み: riad didou 2020 年 8 月 12 日
But i can't find the name of the algorithm for the randsample (i didn't mean the RNG function)!
Adam Danz
Adam Danz 2020 年 8 月 12 日
編集済み: Adam Danz 2020 年 8 月 12 日
But my answer tells you how to find that.
The answer explains that the syntax you're using in randsample is using randperm which uses a uniform pseudorandom number generator of which there are several types. See the "To determine which one you're using..." section to learn how to find which type you're using.

サインインしてコメントする。

回答 (1 件)

Bruno Luong
Bruno Luong 2020 年 8 月 12 日
編集済み: Bruno Luong 2020 年 8 月 12 日
  4 件のコメント
Bruno Luong
Bruno Luong 2020 年 8 月 12 日
Read the pseudo code on the wikipedia link I posted above.
Adam Danz
Adam Danz 2020 年 8 月 12 日
編集済み: Adam Danz 2020 年 8 月 12 日
@riad didou, if you plan on using Matlab's randsample function, you will be relying on a random number generator.
I don't know how else to explain it other than this:
If you call randsample(n,k) or randsample(population, k), that function uses the randperm function whether you want it to or not. According to Matlab's document which I mentioned in the original thread, "The sequence of numbers produced by randperm is determined by the internal settings of the uniform pseudorandom number generator".
"Even if we don't use a random number generator the algorithm still working"
That's not true. The link Bruno provided vaguely describes that values from your array are "randomly" chosen. That requires you to use a random process which is what the random number generator is. Even if you write your own version that doesn't use rng() you'll still need to replace it with some kind of random processes.
Maybe it would help to know your end goal. If the goal it to write about it in a methods section of a paper, I wonder what bits of information you're missing. Many people just write that the function randsample was used in Matlab and they they cite Mathworks but you'd need to document the generator type and seed for reproducibility.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeRandom Number Generation についてさらに検索

製品


リリース

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by