non-uniform distribution in a range

386 views Asked by At

I would like to generate a non-uniform data set in a range which has more data points at the end-tale. Suppose the range is [a-b], a,b>0, and I want to find a way in python to generate a non-uniform data with more data points near the upper bound. Something like reverse of log distribution.

Thanks.

1

There are 1 answers

2
Andrea Citrolo On

If you have already a distribution in mind you can use scipy.


from scipy import stats


a = 2 # just an example min-range value
b = 10 # just an example max-range value
data = stats.beta(2,8)*(b-a) + a # you can alter the shape of the distribution by playing with parameters

Here you can find more about beta distribution.