How to modify a probability distribution with a dictionary for random sampling
aiandbrains.substack.com
I recently saw a post from Devansh - Tech Made Simple about how to sample a list of numbers according to a given probability distribution, like numpy.random.choice does. Since Python provides a random.random function, which samples uniformly, the problem becomes how to use it to sample according to a non-uniform distribution.
How to modify a probability distribution with a dictionary for random sampling
How to modify a probability distribution with…
How to modify a probability distribution with a dictionary for random sampling
I recently saw a post from Devansh - Tech Made Simple about how to sample a list of numbers according to a given probability distribution, like numpy.random.choice does. Since Python provides a random.random function, which samples uniformly, the problem becomes how to use it to sample according to a non-uniform distribution.