mardi 22 octobre 2019

How to choose sample according to distribution?

I have an array of elements [a_1, a_2, ... a_n] and array ofprobabilities associated with this elements [p_1, p_2, ..., p_n].

I want to choose "k" elements from [a_1,...a_n], k << n, according to probabilities [p_1,p_2,...,p_n].

How can I code it in python? Thank you very much, I am not experienced at programming




Aucun commentaire:

Enregistrer un commentaire