简体   繁体   English

范围内的非均匀分布

[英]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.假设范围是[ab],a,b>0,我想在python中找到一种方法来生成一个在上限附近有更多数据点的非均匀数据。 Something like reverse of log distribution.类似于日志分布的反向。

Thanks.谢谢。

If you have already a distribution in mind you can use scipy .如果您已经有一个发行版,您可以使用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. 在这里您可以找到有关 Beta 版分发的更多信息。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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