PrepAway - Latest Free Exam Questions & Answers

Which method might introduce unexpected correlations?

You have a large file of N records (one per line), and want to randomly sample 10% them. You
have two functions that are perfect random number generators (through they are a bit slow):
Random_uniform () generates a uniformly distributed number in the interval [0, 1]
random_permotation (M) generates a random permutation of the number O through M -1.
Below are three different functions that implement the sampling.
Method A
For line in file:
If random_uniform () < 0.1;
Print line
Method B
i = 0
for line in file:
if i % 10 = = 0;
print line

i += 1
Method C
idxs = random_permotation (N) [: (N/10)]
i = 0
for line in file:
if i in idxs:
print line
i +=1
Which method might introduce unexpected correlations?

PrepAway - Latest Free Exam Questions & Answers

A.
Method A

B.
Method B

C.
Method C


Leave a Reply

Your email address will not be published. Required fields are marked *