vendredi 22 mai 2020

Python generate random weighted co-occurrence number

I'm trying to generate a random co-occurrence matrix for words in a corpus. The idea is say the probability of word A's occurrence is 7/200 (7 times in a 200 words corpus) and B is 19/200 (19 time in the same corpus), I want to generate an occurrence number of A and B, with in range of 7 and 19, based on the probability 7/200 and 19/200. I understand that there are functions like random.choices to pick a number from a list but it does not seem to solve this problem. Many thanks for your help.




Aucun commentaire:

Enregistrer un commentaire