Feature request : Add replacement based sampling method with weight decay for
choosing samples from a list/array
I would like to add it with an algorithm as follows :
for _ in range(target_size):
idx = np.random.choice(a, 1, p=p) # Get a sample
samples.append(a[idx]) # Append sample to samples list
p[idx] *= decay_factor # Update probabilities
p /= np.sum(p) # Normalize probabilities
This provides a more representative sample than normal sampling with
replacement as elements that have not been sampled get higher probability of
being sampled later.
I would like to add it to the np.random.choice itself, by adding a parameter
decay_factor that defaults to 1
_______________________________________________
NumPy-Discussion mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/numpy-discussion.python.org/
Member address: [email protected]