mardi 30 mars 2021

Generating a probability distribution P(y) from another probability distribution P(x) such that highest probability in P(x) is least likely in P(y)

So the problem at hand is that I have some values in a dictionary with counters, let's say

dict = {"cats":0, "dogs":0, "lions":0} 

I want to randomly select the keys from this dictionary and increment the counters as I select the particular keys.

But as I select the keys and increment the counters for those keys, I want the probability of selection to be higher of the keys whose counter values are lesser than the other keys.

I have implemented this idea in my answer below. Kindly let me know if this makes sense and if there are any better ways of doing this?




Aucun commentaire:

Enregistrer un commentaire