Python中正态分布的严格正值

发布于 2025-02-12 18:51:11 字数 219 浏览 2 评论 0原文

是否可以像我想在范围(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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

怀里藏娇 2025-02-19 18:51:11

您应该尝试'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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文