I have a list of probabilities that I have generated. Here is a short snippet of what this variable looks like
[0.62, 0.20. 0.0, 0.69, 0.24, 0.50, ...]
These are probabilities that an amino acid substitution will happen in a protein sequence. What I want to do is to take this list of probabilities and generate a list of either True
or False
values based on the probability. I have tried to do this using the numpy.random.choice module in python
numpy.random.choice(a, size=None, replace=True, p=None)
However, when I enter my value for p (the probability distribution) as the variable probabilities
which is my list of probabilities, the interpreter gives the error that p does not sum to 1. I know that p does not sum to 1, so I don't think this is the right python module to use for my purposes. Is there a different way to simply go through a list of probabilities and use those probabilities to either generate True or False?