简体   繁体   中英

non-uniform distribution in a range

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 [ab], 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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM