计算点 p 到高维高斯 (M, V) 的距离
我有一个具有均值 M 和协方差矩阵 V 的高维高斯分布。我想计算从点 p 到 M 的距离,考虑到 V(我猜这是 p 与 M 的标准差的距离?)。
换个角度来说,我取一个距离 M 1 sigma 的椭圆,并想检查 p 是否在该椭圆内部。
I have a high dimensional Gaussian with mean M and covariance matrix V. I would like to calculate the distance from point p to M, taking V into consideration (I guess it's the distance in standard deviations of p from M?).
Phrased differentially, I take an ellipse one sigma away from M, and would like to check whether p is inside that ellipse.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
如果 V 是有效的高斯协方差矩阵,则它是对称正定的,因此定义了有效的标量积。顺便说一下,
inv(V)
也是如此。因此,假设 M 和 p 是列向量,您可以将距离定义为:
将 d2 重写为 Matlab 方式(可能是一些不必要的括号):
好处是,当 V 是单位矩阵时,那么
d1==d2
它对应于经典的欧几里得距离。确定是否必须使用d1
还是d2
留作练习(抱歉,我的工作之一是教学)。写出多维高斯公式并将其与一维情况进行比较,因为多维情况只是一维的特殊情况(或进行一些数值实验)。注意:在非常高的维空间中或对于很多要测试的点,您可能会从 V 的特征向量和特征值(即椭球体的主轴及其相应的方差)中找到一种聪明/更快的方法。
希望这有帮助。
一个。
If
V
is a valid covariance matrix of a gaussian, it then is symmetric positive definite and therefore defines a valid scalar product. By the wayinv(V)
also does.Therefore, assuming that M and p are column vectors, you could define distances as:
the Matlab way one would rewrite
d2
as (probably some unnecessary parentheses):The nice thing is that when V is the unit matrix, then
d1==d2
and it correspond to the classical euclidian distance. To find wether you have to used1
ord2
is left as an exercise (sorry, part of my job is teaching). Write the multi-dimensional gaussian formula and compare it to the 1D case, since the multidimensional case is only a particular case of the 1D (or perform some numerical experiment).NB: in very high dimensional spaces or for very many points to test, you might find a clever / faster way from the eigenvectors and eigenvalues of V (i.e. the principal axes of the ellipsoid and their corresponding variance).
Hope this helps.
A.
考虑计算给定正态分布的点的概率:
函数 MVNPDF由统计工具箱提供
Consider computing the probability of the point given the normal distribution:
The function MVNPDF is provided by the Statistics Toolbox
也许我完全不对劲,但这不就和问每个维度一样吗:我在西格玛内吗?
伪代码:
因为你想知道 p 是否在高斯的每个维度内。所以实际上,这只是一个空间问题,你的高斯不必对此做任何事情(除了 M 和 sigma,它们只是距离)。
在 MATLAB 中,您可以尝试类似的操作:
到那个地方的距离可能是,我不知道欧几里得距离的函数。也许 dist 有效:
因为 M 只是空间中的一个点,p 也是。只有 2 个向量。
现在是最后一场。您想知道西格玛形式的距离:
我认为这可以解决问题。
Maybe I'm totally off, but isn't this the same as just asking for each dimension: Am I inside the sigma?
PSEUDOCODE:
Because you want to know if p is inside every dimension of your gaussian. So actually, this is just a space problem and your Gaussian hasn't have to do anything with it (except for M and sigma which are just distances).
In MATLAB you could try something like:
A distance to that place could be, where I don't know the function for the Euclidean distance. Maybe dist works:
Because M is just a point in space and p as well. Just 2 vectors.
And now the final one. You want to know the distance in a form of sigma's:
I think that will do the trick.