C ++函数,它使用浓缩高斯检查返回一个布尔值 [英] C++ function that returns me a boolean value from check with a concentrated gaussian

查看:93
本文介绍了C ++函数,它使用浓缩高斯检查返回一个布尔值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要创建一个C ++函数,如果我检查的点(x,y,z)的值接近高斯集中的位置(即,均值等于),则返回一个布尔值(true或false)它居中(xg,yg,zg)。



我的意思是,高斯中心是(10,10,5)。



如果当前点(x,y,z)的概率大于0.5(在高斯概率值的0-1范围内)返回true



否则返回false。



我不知道如何实现以这种方式工作的高斯...有人可以帮助我?这是怎么回事?



我正在使用Visual C ++ 2010.



提前感谢所有人。

I need to create a C++ function that returns me a boolean value (true or false) if the value of the point that I check (x, y, z) approaches where the Gaussian concentrated (ie, with mean equal to) it's centered (xg, yg, zg).

I mean, center of gaussian is (10,10,5).

if the probability of the current point (x,y,z) it's greater than 0.5 (on a 0-1 range of values ​​of probability of the Gaussian) return true

else return false.

I don't know how implement a Gaussian that work in this way...can someone help me? How do this?

I'm using Visual C++ 2010.

Thanks in advance to all.

推荐答案

我不是专家,但我想你必须计算(即近似)三维空间中高斯概率分布的累积,即积分对于以高斯为中心的球体中的高斯概率分布,并且射线等于点与该中心的距离。
I am not an expert, but I suppose you have to compute (that is approximate) the cumulative of the gaussian probability distribution in three dimensional space, i.e. the integral of the gaussian probability distribution in the sphere centered on the gaussian and having ray equal to the distance of your point from such center.


您需要知道标准偏差:对于高斯分布,标准差告诉你一些关于变量概率超过某个值的范围。 E. g。如果变量x的标准偏差是3,并且平均期望值是10,那么x的概率是>在10-3 = 7和10 + 3 = 13之间x为68%。请参见 http://en.wikipedia.org/wiki/Normal_distribution [ ^ ]



查找概率的距离只需大约50%,您需要查看从误差函数派生的容差区间。请参见 http://www.itl.nist.gov/div898/handbook/prc/section2 /prc263.htm [ ^ 。遗憾的是,没有直接的方法来计算该值,但您可以在预先计算的表中查找它,大约是标准偏差的0.68到0.69倍。请参见 http://www.itl.nist.gov/div898/handbook/eda/section3 /eda3671.htm [ ^ ]



将此扩展为两个变量,您需要检查多变量正态分布 [ ^ ]。如果变量X和Y的分布函数是独立的,则变量对(X,Y)的结果分布函数只是两个分布函数的乘积。具有50%可能性的值的范围现在是椭圆而不是间隔 - 参见上面链接中的图像。



同样,如果X,Y和Z是独立变量,则三重(X,Y,Z)的分布函数只是三者的乘积分配功能。因此,如果X,Y和Z的标准偏差分别为xs,ys和zs,那么包含具有大于50%可能性的所有三元组的3D区域的形状是具有半轴长度的3D椭球xs,ys和zs。请参见 http://en.wikipedia.org/wiki/Ellipsoid [ ^ ]



关于这个的好处是你实际上不需要计算任何正常函数来确定一个点是否在这个区域内 - 而是你可以通过计算以下值直接确定这个椭圆体中的哪些点:

You need to know the standard deviation: for the gaussian distribution, the standard deviation tells you something about the range within which the probability of the variable rises above a certain value. E. g. if your standard deviation for variable x is 3, and the average expected value is 10, then the probability for x is > 68% for x between 10-3=7 and 10+3=13. See http://en.wikipedia.org/wiki/Normal_distribution[^]

To find the distance within which the probability is just about 50%, you need to look at the Tolerance interval, derived from the error function. See http://www.itl.nist.gov/div898/handbook/prc/section2/prc263.htm[^]. unfortunately there is no direct way to compute that value, but you can look it up in precalculated tables to be somewhere around 0.68 to 0.69 times the standard deviation. See http://www.itl.nist.gov/div898/handbook/eda/section3/eda3671.htm[^]

Extending this to two variables, you need to check on Multivariate normal distributions[^]. If the distribution functions of the variables X and Y are independend, then the resulting distribution function of the variable pair (X,Y) is just the product of the two distribution functions. The range of values with a 50% likelyhood is now an ellipse rather than an interval - see the image in the above link.

Similarly, if X, Y, and Z are independend variables, then the distribution function for the triple (X,Y,Z) is just the product of the three distribution functions. Therefore, if the standard deviations for X, Y, and Z are xs, ys, and zs respectively, then the shape of the 3D-area containing all triples with a greater than 50% likelyhood is a 3D ellipsoid with semi-axes of length xs, ys, and zs. See http://en.wikipedia.org/wiki/Ellipsoid[^]

The nice thing about this is that you don't actually need to calculate any normal function to determine whether a point is within this area - instead you can just determine directly which points lie within this ellipsoid by calculating the following value:
(X-xg)^2 / xs^2 + (Y-yg)^2 / ys^2 + (Z-zs)^2 / zs^2



对于椭球内的点,该值将小于1,对于外面的点将更大!


For points within the ellipsoid, this value will be less than 1, for points outside it will be greater!


这篇关于C ++函数,它使用浓缩高斯检查返回一个布尔值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆