vendredi 31 août 2018

How to assign probabilities based on certain condition?

I have run into a wall here. So i pull random sample of, lets say 10 elements, and i want to give them probabilities, based on some condition. Lets say that i have this random sample [1, 3, 5, 7, 13, 16, 6, 9, 22, 15] so i want to give each number a probability based on the relative distance from int of 8. Further element is from 8, less the probability. In this case 7 and nine have same, biggest probabilities and 22 have the smallest?

I tried to find some numpy function, but with no success.

Thanks!




Aucun commentaire:

Enregistrer un commentaire