假设二维空间中有8个样本点分成以下两类。第1类:02-2035-3-5第2类:35138602。请计算两类样本的均值与协方差矩阵计算02与35分别在两类中的马氏距离。给出具体计算转换过程。
第一类样本的均值为:$(\frac{0-2+3-3}{4},\frac{2+0+5-5}{4})=(-0.5,0)$
第二类样本的均值为:$(\frac{3+1+8+0}{4},\frac{5+3+6+2}{4})=(3,4)$
第一类样本的协方差矩阵为:
$$ \begin{pmatrix} \frac{(-0.5-(-0.5))^2+(-2-(-0.5))^2+(3-(-0.5))^2+(-3-(-0.5))^2}{3} & \frac{(2-0)\times(-2-0)+(2-0)\times(5-0)+(2-0)\times(-5-0)+(0-0)\times(-2-0)}{3}\ \frac{(2-0)\times(-2-0)+(2-0)\times(5-0)+(2-0)\times(-5-0)+(0-0)\times(-2-0)}{3} & \frac{(2-0)^2+(2-0)^2+(2-0)^2+(0-0)^2}{3} \end{pmatrix}
\begin{pmatrix} 9.5 & 0\ 0 & 4 \end{pmatrix} $$
第二类样本的协方差矩阵为:
$$ \begin{pmatrix} \frac{(3-3)^2+(1-3)^2+(8-3)^2+(0-3)^2}{3} & \frac{(5-4)\times(3-3)+(5-4)\times(1-3)+(5-4)\times(6-3)+(2-4)\times(0-3)}{3}\ \frac{(5-4)\times(3-3)+(5-4)\times(1-3)+(5-4)\times(6-3)+(2-4)\times(0-3)}{3} & \frac{(5-4)^2+(3-4)^2+(6-4)^2+(2-4)^2}{3} \end{pmatrix}
\begin{pmatrix} 9.5 & 6\ 6 & 4.5 \end{pmatrix} $$
(0,2)在第一类中的马氏距离为:
$$ \sqrt{[(0-(-0.5)),(2-0)]\cdot \begin{pmatrix} 9.5 & 0\ 0 & 4 \end{pmatrix}^{-1} \cdot[(0-(-0.5)),(2-0)]^T}
\sqrt{\begin{pmatrix} 0.5 & 2 \end{pmatrix} \cdot \begin{pmatrix} 0.1053 & 0\ 0 & 0.25 \end{pmatrix} \cdot \begin{pmatrix} 0.5\ 2 \end{pmatrix}} \approx 2.016 $$
(0,2)在第二类中的马氏距离为:
$$ \sqrt{[(0-3),(2-5)]\cdot \begin{pmatrix} 9.5 & 6\ 6 & 4.5 \end{pmatrix}^{-1} \cdot[(0-3),(2-5)]^T}
\sqrt{\begin{pmatrix} -3 & -3 \end{pmatrix} \cdot \begin{pmatrix} 0.0833 & -0.1667\ -0.1667 & 0.3333 \end{pmatrix} \cdot \begin{pmatrix} -3\ -3 \end{pmatrix}} \approx 3.215 $$
(3,5)在第一类中的马氏距离为:
$$ \sqrt{[(3-(-0.5)),(5-0)]\cdot \begin{pmatrix} 9.5 & 0\ 0 & 4 \end{pmatrix}^{-1} \cdot[(3-(-0.5)),(5-0)]^T}
\sqrt{\begin{pmatrix} 3.5 & 5 \end{pmatrix} \cdot \begin{pmatrix} 0.1053 & 0\ 0 & 0.25 \end{pmatrix} \cdot \begin{pmatrix} 3.5\ 5 \end{pmatrix}} \approx 2.982 $$
(3,5)在第二类中的马氏距离为:
$$ \sqrt{[(3-3),(5-4)]\cdot \begin{pmatrix} 9.5 & 6\ 6 & 4.5 \end{pmatrix}^{-1} \cdot[(3-3),(5-4)]^T}
\sqrt{\begin{pmatrix} 0 & 1 \end{pmatrix} \cdot \begin{pmatrix} 0.0833 & -0.1667\ -0.1667 & 0.3333 \end{pmatrix} \cdot \begin{pmatrix} 0\ 1 \end{pmatrix}} \approx 0.577 $
原文地址: https://www.cveoy.top/t/topic/fsap 著作权归作者所有。请勿转载和采集!