Python中正态分布的严格正值
是否可以像我想在范围(0,10)
中使用特定mu,Sigma
在范围内定义正态分布的严格正范围?
使用np.random.normal
,有时我会得到我不想要的负值。
import numpy as np
I=np.random.normal(3, 10, size=(3,3))
Is it possible to define a strictly positive range for normal distribution like I want to have a distribution in the range (0,10)
with a certain mu, sigma
?
Using np.random.normal
, sometimes I get negative values which I don't want.
import numpy as np
I=np.random.normal(3, 10, size=(3,3))
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您应该尝试'scipy.stats.truncnorm' - QUOTE 此分布的标准形式是标准的正常截断为范围
https://docs.scipy.org/doc/scipy/reference/generated/scipy.stats.truncnorm.html
You should try 'scipy.stats.truncnorm' - quote The standard form of this distribution is a standard normal truncated to the range
https://docs.scipy.org/doc/scipy/reference/generated/scipy.stats.truncnorm.html