如何检查我的(x,y)是否进行了高斯采样?
我想从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)
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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论