如何使用协方差矩阵计算 sigma_1 和 sigma_2

How to calculate sigma_1 and sigma_2 with Covariance Matrix

我正在阅读this article

在“协方差矩阵和 SVD”部分,
有两个 \sigma,分别是 \sigma_1 和 \sigma_2.
这些值分别是 14.40.19
我怎样才能得到这些值?
我已经用 Numpy 计算了协方差矩阵:

import numpy as np

a = np.array([[2.9, -1.5, 0.1, -1.0, 2.1, -4.0, -2.0, 2.2, 0.2, 2.0, 1.5, -2.5], 
               [4.0, -0.9, 0.0, -1.0, 3.0, -5.0, -3.5, 2.6, 1.0, 3.5, 1.0, -4.7]])

cov_mat = (a.shape[1] - 1) * np.cov(a)
print(cov_mat)

# b = np.std(a, axis=1)**0.5
b = (a.shape[1] - 1) * np.std(a, axis=1)**0.5
# b = np.std(cov_mat, axis=1)
# b = np.std(cov_mat, axis=1)**0.5
print(b)

结果是:

[[ 53.46  73.42]
 [ 73.42 107.16]]
[15.98102431 19.0154037 ]

无论我做什么,我都得不到14.40.19。 它们只是错误的价值观吗?

请帮助我。提前谢谢你。

不知道你为什么“un-sampled”你的协方差,但原始 np.cov 输出是你想要得到的特征值:

np.linalg.eigvalsh(np.cov(a))

Out[]: array([ 0.19403958, 14.4077786 ])