问题
I have a data set that is made up of a binary sequence, e.g.
0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 1, ...
the probability of 0 and 1 (noise) is different with 1 being less frequent. I want to know if these 1s happens in groups or they are really just random. How can I tell?
If I feed it into randomness test, it will sure tell me the sequence are heavily gravitating toward 0. Would measuring the gap between 1s be a good test? I am most familiar with Python and C.
回答1:
Here, the word "random" means not only identically distributed (biased the same way), but also independent (that is, independent of any other choice). In general, randomness tests are more reliable on the first part of this definition ("identically distributed") than on the second ("independent").
In general, you can't tell from a sequence of bits alone whether the process generated them in an independent and identically distributed way, unless you know what that process is. Thus, although you can tell that a given sequence of bits has more zeros than ones, you can't tell whether those bits—
- were truly generated independently of any other choice, or
- form part of an extremely long periodic sequence that is only "locally random", or
- were simply reused from another process, or
- were produced in some other way,
without more information on the process.
来源:https://stackoverflow.com/questions/63727734/checking-noise-in-binary-sequence-for-randomness