如何检查我的(x,y)是否进行了高斯采样?

发布于 2025-01-30 06:57:55 字数 920 浏览 1 评论 0原文

我想从2D高斯(2d Gaussian指向3D高斯图的表面。

我为此做了以下操作:

"r"
 mu=np.random.uniform(0,1,10000)
 r=[sqrt(-2*log(1-i)) for i in mu]
 "theta"
 eta=np.random.uniform(0,1,10000)
 theta=2*pi*eta;
 cuz=[cos(i) for i in theta]
 suz=[sin(i) for i in theta]
 "initial conditions"
 Zinitial=[a*b for a,b in zip(r,cuz)];
 Pinitial=[a*b for a,b in zip(r,suz)];

我现在想确认这些数据点是否实际上是通过绘制轮廓或3-D图对高斯采样的。

我该怎么做?

现在考虑以下代码: 考虑以下代码:

def gauss2d(mu,sigma):
    x=gauss(mu,sigma);
    y=gauss(mu,sigma);
 return(x,y)
ic=[];
for i in range(50):
    ic.append(gauss2d(0,1))
    x=[x[0] for x in ic];
t=np.linspace(-2,2,50)
plt.plot(x,t)

这就是我得到的。

为什么它看起来不像高斯曲线?

我对此的情节以及我使用不同的方法匹配的图,但两者看起来都不像高斯,而是图上面的情节。

I want to get (x,y) of 100 particles (x and y being initial conditions) sampled from a 2D gaussian where the 2-D gaussian is a product of two 1-D Gaussians so that (x,y) corresponds to a point on the surface of a 3D gaussian figure.

I did the following for that:

"r"
 mu=np.random.uniform(0,1,10000)
 r=[sqrt(-2*log(1-i)) for i in mu]
 "theta"
 eta=np.random.uniform(0,1,10000)
 theta=2*pi*eta;
 cuz=[cos(i) for i in theta]
 suz=[sin(i) for i in theta]
 "initial conditions"
 Zinitial=[a*b for a,b in zip(r,cuz)];
 Pinitial=[a*b for a,b in zip(r,suz)];

I now want to confirm whether these data points actually are gaussian sampled by drawing contour or 3-d plot.

How can I do that?

Now consider the following code:
Consider the following code:

def gauss2d(mu,sigma):
    x=gauss(mu,sigma);
    y=gauss(mu,sigma);
 return(x,y)
ic=[];
for i in range(50):
    ic.append(gauss2d(0,1))
    x=[x[0] for x in ic];
t=np.linspace(-2,2,50)
plt.plot(x,t)

This is what I get.
enter image description here

Why doesn't it look like a gaussian curve?

My plots of this and the one I did with a different method match but both don't look like a gaussian but the plot like above.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文