https://blogs.sas.com/content/iml/2012/02/15/what-is-mahalanobis-distance.html

https://blogs.sas.com/content/iml/2012/02/08/.html

https://stats.stackexchange.com/questions/62092/bottom-to-top-explanation-of-the-mahalanobis-distance
上面三个网页对马氏距离解释的很好

A variance-covariance matrix expresses linear relationships between variables. Given the covariances between variables, did you know that you can write down an invertible linear transformation that “uncorrelates” the variables? Conversely, you can transform a set of uncorrelated variables into variables with given covariances. The transformation that works this magic is called the Cholesky transformation; it is represented by a matrix that is the “square root” of the covariance matrix.

The Square Root Matrix
Given a covariance matrix, Σ, it can be factored uniquely into a product Σ=UTU, where U is an upper triangular matrix with positive diagonal entries and the superscript denotes matrix transpose. The matrix U is the Cholesky (or “square root”) matrix. Some people (including me) prefer to work with lower triangular matrices. If you define L=UT, then Σ=LLT. This is the form of the Cholesky decomposition that is given in Golub and Van Loan (1996, p. 143). Golub and Van Loan provide a proof of the Cholesky decomposition, as well as various ways to compute it.

Geometrically, the Cholesky matrix transforms uncorrelated variables into variables whose variances and covariances are given by Σ. In particular, if you generate p standard normal variates, the Cholesky transformation maps the variables into variables for the multivariate normal distribution with covariance matrix Σ and centered at the origin (denoted MVN(0, Σ)).

The Cholesky Transformation: The Simple Case
Let’s see how the Cholesky transofrmation works in a very simple situation. Suppose that you want to generate multivariate normal data that are uncorrelated, but have non-unit variance. The covariance matrix for this situation is the diagonal matrix of variances: Σ = diag(σ21,…,σ2p). The square root of Σ is the diagonal matrix D that consists of the standard deviations: Σ = DTD where D = diag(σ1,…,σp).

Geometrically, the D matrix scales each coordinate direction independently of the other directions. This is shown in the following image. The X axis is scaled by a factor of 3, whereas the Y axis is unchanged (scale factor of 1). The transformation D is diag(3,1), which corresponds to a covariance matrix of diag(9,1). If you think of the circles in the top image as being probability contours for the multivariate distribution MVN(0, I), then the bottom shows the corresponding probability ellipses for the distribution MVN(0, D).

Geometry of transformation: A diagonal matrix transforms uncorrelated standardized variables to uncorrelated scaled variables. Shown for bivariate data.
The General Cholesky Transformation Correlates Variables
In the general case, a covariance matrix contains off-diagonal elements. The geometry of the Cholesky transformation is similar to the “pure scaling” case shown previously, but the transformation also rotates and shears the top image.

The following graph shows the geometry of the transformation in terms of the data and in terms of probability ellipses. The top graph is a scatter plot of the X and Y variables. Notice that they are uncorrelated and that the probability ellipses are circles. The bottom graph is a scatter plot of the Z and W variables. Notice that they are correlated and the probability contours are ellipses that are tilted with respect to the coordinate axes. The bottom graph is the transformation under L of points and circles in the top graph.


The Inverse Cholesky Transformation Uncorrelates Variables
You might wonder: Can you go the other way? That is, if you start with correlated variables, can you apply a linear transformation such that the transformed variables are uncorrelated? Yes, and it’s easy to guess the transformation that works: it is the inverse of the Cholesky transformation!

Suppose that you generate multivariate normal data from MVN(0,Σ). You can “uncorrelate” the data by transforming the data according to L^-1

Success! The covariance matrix is essentially the identity matrix. The inverse Cholesky transformation “uncorrelates” the variables.

The TRISOLV function, which uses back-substitution to solve the linear system, is extremely fast. Anytime you are trying to solve a linear system that involves a covariance matrix, you should try to solve the system by computing the Cholesky factor of the covariance matrix, followed by back-substitution.

In summary, you can use the Cholesky factor of a covariance matrix in several ways:

To generate multivariate normal data with a given covariance structure from uncorrelated normal variables.
To remove the correlations between variables. This task requires using the inverse Cholesky transformation.
To quickly solve linear systems that involve a covariance matrix.



What is Mahalanobis distance? 马氏距离相关推荐

  1. 各种距离 欧式距离、曼哈顿距离、切比雪夫距离、闵可夫斯基距离、标准欧氏距离、马氏距离、余弦距离、汉明距离、杰拉德距离、相关距离、信息熵...

    1. 欧氏距离(Euclidean Distance) 欧氏距离是最容易直观理解的距离度量方法,我们小学.初中和高中接触到的两个点在空间中的距离一般都是指欧氏距离. 二维平面上点a(x1,y1)与b( ...

  2. 曼哈顿距离,欧式距离,明式距离,切比雪夫距离以及马氏距离

    1.曼哈顿距离 曼哈顿距离又称Manhattan distance,还见到过更加形象的,叫出租车距离的.具体贴一张图,应该就能明白. 上图摘自维基百科,红蓝黄皆为曼哈顿距离,绿色为欧式距离. 2.欧式 ...

  3. K邻近算法概述、欧式距离、Scikit-learn使用 、kNN邻近算法距离度量、曼哈顿距离、切比雪夫距离、闵可夫斯基距离、标准化欧氏距离、余弦距离、汉明距离、杰卡德距离、马氏距离

    一.K-邻近算法概述 K邻近算(K Nearest Neighbor算法,KNN算法):如果一个样本在特征空间中的k个最相似(即特征空间中最邻近)的样本中的大多数属于某一个类别,则该样本也属于这个类别 ...

  4. matlab求距离判别函数,马氏距离判别法matlab

    -2.7137 -3.9604 2.两个总体协方差矩阵不相等 在MATLAB中mahal 计算马氏距离平方 d = mahal(Y,X) 输入:Y是要判别的 样本点,通常是矩阵Ymn X是已知总体的. ...

  5. 马氏距离 (马哈拉诺比斯距离) (Mahalanobis distance)

    马氏距离(Mahalanobis distance)是由印度统计学家马哈拉诺比斯(P. C. Mahalanobis)提出的,表示点与一个分布之间的距离.它是一种有效的计算两个未知样本集的相似度的方法 ...

  6. 马氏距离(Mahalanobis Distance)介绍与实例

    本文介绍马氏距离(Mahalanobis Distance),通过本文,你将了解到马氏距离的含义.马氏距离与欧式距离的比较以及一个通过马氏距离进行异常检测的例子(基于Python的sklearn包). ...

  7. 马氏距离(Mahalanobis Distance)推导及几何意义

    看了一些博客对马氏距离的解释,似乎没有讲到本质的地方,本文从欧氏距离存在的问题开始入手,一步步推导出马氏距离,并得出结论:原始空间中的马氏距离等于坐标旋转变换及缩放后的空间中的欧氏距离. 假设数据集 ...

  8. 【知识学习】马氏距离 Mahalanobis Distance

    目录 1. 协方差的意义 2. 马氏距离 2.1 概述 2.2 公式 2.3 实际意义 2.4 局限性 2.4.1 协方差矩阵必须满秩[不平衡数据少数类一般都不是] 2.4.2 不能处理非线性流形(m ...

  9. 机器学习中的数学——距离定义(六):马氏距离(Mahalanobis Distance)

    分类目录:<机器学习中的数学>总目录 相关文章: · 距离定义:基础知识 · 距离定义(一):欧几里得距离(Euclidean Distance) · 距离定义(二):曼哈顿距离(Manh ...

最新文章

  1. 如何利用PopupWindow实现弹出菜单并解决焦点获取以及与软键盘冲突问题
  2. 如何让 Hyper-V 和 VMware 虚拟机软件共存?
  3. Qt之QSpacerItem
  4. 使用调试的方式搞清楚SAP UI5应用标题的更改方式
  5. 张爱玲《小团圆》的备忘和感想 (一)
  6. Iterable 超级接口
  7. linux终端的背景_如何在终端显示图像缩略图 | Linux 中国
  8. 什么是电磁兼容标准?IEC、EN、TC77、CISPR等的区别!
  9. 关于MAC解决jupyter中出现nbconvert failed/ xelatex not found on path报错
  10. 读书笔记《松本行弘的程序世界》
  11. 解决Windows10 ssh连接Linux服务器Unable to negotiate with xx.xx.xx.xx port xx: no matching key exchange meth
  12. java集成kettle 8.2 获取转换的执行日志与步骤度量
  13. 休谟问题和金岳霖的回答
  14. java 实现超时_Java任务超时处理机制实现
  15. 太湖之光超级计算机使用申请,神威太湖之光系统快速使用指南-国家超级计算无锡中心.PDF...
  16. 889-Linux主机网络流量抓包监控
  17. git 乱改你的换行符?一句话设置让 git 不再碰你某个文件的换行符
  18. c语言五子棋游戏源程序代码,C语言五子棋游戏源代码
  19. 广西最新初级消防设施操作员考试真题及答案
  20. th:if比较字符串

热门文章

  1. getFields()和getDeclaredFields的区别
  2. COCOS2D创建菜单,按钮区域和文字显示不一致
  3. 人工智能(AI)遇上仿制药
  4. python 中UnicodeEncodeError 错误
  5. php7降到5.6,如何在Fedora 25上从php 7降级到5.6
  6. python acm 素数个数_湘潭大学OJ-1098求区间内素数个数问题
  7. ISME:根系招募特异型菌群增强植物对盐胁迫的抗性
  8. 微生物组领域最高质量的资源全在这
  9. Sciences:Knight组发表尸体降解过程中的微生物组
  10. Nature综述:进化病毒毒力的系统发育基因组学