オムライスの備忘録

数学・統計学・機械学習・プログラミングに関することを記す

【幾何学】マハラノビス距離 / Mahalanobis Distance

yhayato1320.hatenablog.com

Index

マハラノビス距離 / Mahalanobis Distance とは

 p 個の特徴量を持つ変数  x\ =\ (x_1,\ \cdots,\ x_p)^{T} に関して、
2 つのクラス (群) の観測された学習データを以下のように定義したとする.

 G_{1}\ :\ x_{1}^{(1)},\ \cdots,\ x_{n_{1}}^{1}
 G_{2}\ :\ x_{1}^{(2)},\ \cdots,\ x_{n_{2}}^{2}




各クラス (群) の学習データに基づく標本平均ベクトル  \bar{x}
および標本分散共分散行列  Sは、以下のようになる.


G_{1}\ :
\ \ \ \bar{x}_{1}\ =\ \displaystyle \frac{1}{n_{1}} \displaystyle \sum_{i=1}^{n_{1}} x_{i}^{(1)},
\ \ \ S_{1}\ =\ \displaystyle \frac{1}{n_{1} - 1} \displaystyle \sum_{i=1}^{n_{1}}
(x_{i}^{(1)}\ -\ \bar{x}_{1})(x_{i}^{(1)}\ -\ \bar{x}_{1})^{T}


G_{2}\ :
\ \ \ \bar{x}_{2}\ =\ \displaystyle \frac{1}{n_{2}} \displaystyle \sum_{i=1}^{n_{2}} x_{i}^{(1)},
\ \ \ S_{2}\ =\ \displaystyle \frac{1}{n_{2} - 1} \displaystyle \sum_{i=1}^{n_{2}}
(x_{i}^{(2)}\ -\ \bar{x}_{2})(x_{i}^{(2)}\ -\ \bar{x}_{2})^{T}



そして新たにデータ  x が採られたとき、このデータから
クラス (群)  G_1 の標本平均ベクトル  \bar{x}_{1}
クラス (群)  G_2 の標本平均ベクトル  \bar{x}_2 への距離を以下のように定義する.

 D_{1}^{2}\ =\ (x\ -\ \bar{x}_{1})^{T} S_{1}^{-1}(x\ -\ \bar{x}_{1})

 D_{2}^{2}\ =\ (x\ -\ \bar{x}_{2})^{T} S_{2}^{-1}(x\ -\ \bar{x}_{2})



観測データの散らばりの程度を標本分散共分散で測り、
このデータの散らばりを考慮に入れた距離は、マハラノビス距離 / Mahalanobis Distance と呼ばれる.

アルゴリズムへの応用

  • DeepSORT

yhayato1320.hatenablog.com

参考

Web サイト