(from:http://en.wikipedia.org/wiki/Mahalanobis_distance)

Mahalanobis distance

In statisticsMahalanobis distance is a distance measure introduced by P. C. Mahalanobis in 1936.It is based on correlations between variables by which different patterns can be identified and analyzed. It gauges similarity of an unknown sample set to a known one. It differs fromEuclidean distance in that it takes into account the correlations of the data set and is scale-invariant. In other words, it is a multivariateeffect size.

Definition

Formally, the Mahalanobis distance of a multivariate vector  from a group of values with mean  and covariance matrix  is defined as:

(注:1.这个是X和总体均值的马氏距离。2.这里的S是可逆的,那么协方差矩阵不可逆的话怎么办?)

Mahalanobis distance (or "generalized squared interpoint distance" for its squared value) can also be defined as a dissimilarity measure between two random vectors  and  of the same distribution with the covariance matrix  :

If the covariance matrix is the identity matrix, the Mahalanobis distance reduces to the Euclidean distance. If the covariance matrix is diagonal, then the resulting distance measure is called the normalized Euclidean distance:

where  is the standard deviation of the  ( ) over the sample set.

(源自:百度百科)

马氏优缺点:

1.马氏距离的计算是建立在总体样本的基础上的,这一点可以从上述协方差矩阵的解释中可以得出,也就是说,如果拿同样的两个样本,放入两个不同的总体中,最后计算得出的两个样本间的马氏距离通常是不相同的,除非这两个总体的协方差矩阵碰巧相同。
 
2.在计算马氏距离过程中,要求总体样本数大于样本的维数,否则得到的总体样本协方差矩阵逆矩阵不存在,这种情况下,用欧式距离计算即可。
 
3.还有一种情况,满足了条件总体样本数大于样本的维数,但是协方差矩阵的逆矩阵仍然不存在,比如三个样本点(3,4),(5,6)和(7,8)这种情况是因为这三个样本在其所处的二维空间平面内共线。这种情况下,也采用欧式距离计算。
 
4.在实际应用中“总体样本数大于样本的维数”这个条件是很容易满足的,而所有样本点出现3)中所描述的情况是很少出现的,所以在绝大多数情况下,马氏距离是可以顺利计算的,但是马氏距离的计算是不稳定的,不稳定的来源是协方差矩阵,这也是马氏距离与欧式距离的最大差异之处。
   
优点:它不受量纲的影响,两点之间的马氏距离与原始数据的测量单位无关;由标准化数据和中心化数据(即原始数据与均值之差)计算出的二点之间的马氏距离相同。马氏距离还可以排除变量之间的相关性的干扰。
 
缺点:它的缺点是夸大了变化微小的变量的作用。

Mahalanobis Distance(马氏距离)的更多相关文章

  1. paper 114:Mahalanobis Distance(马氏距离)

    (from:http://en.wikipedia.org/wiki/Mahalanobis_distance) Mahalanobis distance In statistics, Mahalan ...

  2. Mahalanobia Distance(马氏距离)的解释

    马氏距离有多重定义: 1)可以表示 某一个样本与DataSet的距离. 2)可以表示两个DataSet之间的距离. 1) The Mahalanobis distance of an observat ...

  3. 马氏距离(Mahalanobis distance)

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

  4. MATLAB求马氏距离(Mahalanobis distance)

    MATLAB求马氏距离(Mahalanobis distance) 作者:凯鲁嘎吉 - 博客园 http://www.cnblogs.com/kailugaji/ 1.马氏距离计算公式 d2(xi,  ...

  5. Mahalanobis距离(马氏距离)的“哲学”解释

    讲解教授:赵辉 (FROM : UESTC) 课程:<模式识别> 整理:PO主 基础知识: 假设空间中两点x,y,定义: 欧几里得距离, Mahalanobis距离, 不难发现,如果去掉马 ...

  6. 有关马氏距离和hinge loss的学习记录

    关于度量学习,之前没有看太多相关的文献.不过南京的周老师的一篇NIPS,确实把这个问题剖析得比较清楚. Mahalanobis距离一般表示为d=(x-y)TM(x-y),其中x和y是空间中两个样本点, ...

  7. 基于欧氏距离和马氏距离的异常点检测—matlab实现

    前几天接的一个小项目,基于欧氏距离和马氏距离的异常点检测,已经交接完毕,现在把代码公开. 基于欧式距离的: load data1.txt %导入数据,行为样本,列为特征 X=data1; %赋值给X ...

  8. Python实现的计算马氏距离算法示例

    Python实现的计算马氏距离算法示例 本文实例讲述了Python实现的计算马氏距离算法.分享给大家供大家参考,具体如下: 我给写成函数调用了 python实现马氏距离源代码:     # encod ...

  9. Levenshtein Distance莱文斯坦距离算法来计算字符串的相似度

    Levenshtein Distance莱文斯坦距离定义: 数学上,两个字符串a.b之间的莱文斯坦距离表示为levab(|a|, |b|). levab(i, j) = max(i, j)  如果mi ...

随机推荐

  1. setAttribute一个兼容性问题

    前几天工作中遇到一个js问题,本来js就不大会,倒腾了好长时间,并在做弹窗的时候用到了setAttribute,出现了不兼容的问题,在网上查了好多,真是郁闷,看来啥都得学啊. 主要的工作是做一个根据时 ...

  2. iOS 5.0 后UIViewController新增:willMoveToParentViewController和didMoveToParentViewCon

    在iOS 5.0以前,我们在一个UIViewController中这样组织相关的UIView   在以前,一个UIViewController的View可能有很多小的子view.这些子view很多时候 ...

  3. Android画柱状图,圆形图和折线图的demo

    效果图如下: demo下载地址:http://files.cnblogs.com/hsx514/wireframe.zip

  4. linux 安装SVN

    1.环境centos6.4 2.安装svnyum -y install subversion 3.配置 建立版本库目录mkdir /www/svndata svnserve -d -r /www/sv ...

  5. every day english

    job is in your freedom, not your compliance. through no fault of his own. as far as I understand you ...

  6. 自动抓取java堆栈

    参数1 进程名字,参数2 最大线程数 例: pid为8888,达到1000个线程时自动抓取堆栈信息 ./autojstack.sh 8888 1000 & #!/bin/bashfileNam ...

  7. 【IDE】SharpDevelop

    SharpDevelop 这个轻型的开发工具支持多种程序语言,包括C#.java以及VB.NET,同时还支持多种语言界面,象任何爱好者开发的工具一样.这个编辑器的界面风格类似于Office XP以及V ...

  8. shell 内网主机存活探测器

    最近在学习shell 编程,闲来无事,搞了一个小shell. 可以用来 对一个网段的存活主机进行 探测. #!/bin/bash # #// #blog:www.cnblogs.com/outline ...

  9. JavaScript的function对象

    我必须先说Java与JavaScript没有关系,不是我以前想的那个样子的(JavaScript是Java的一种超进化) 在JavaScript中,函数(function)就是对象. JavaScri ...

  10. nodejs 基本操作

    查看nodejs版本 nodejs -v 升级nodejs node有一个模块叫n(这名字可够短的...),是专门用来管理node.js的版本的.首先安装n模块:npm install -g n 第二 ...