Numpy 奇异值在奇异值分解计算中的应用

Numpy 奇异值在奇异值分解计算中的应用,numpy,svd,Numpy,Svd,我有一个问题要问 A = array([ [1,2,3,4,5,6,7,8,9,10], [11,12,13,14,15,16,17,18,19,20], [21,22,23,24,25,26,27,28,29,30]]) print(A) # Singular-value decomposition U, s, VT = svd(A) 因为上面的“s”应该是(10)的形状,因为我们有10个特征,但是没有显示(3)。示例输出如下所示,我感到困惑。请解释一下,我们为什么去(3,) 让我们考虑另一

我有一个问题要问

A = array([
[1,2,3,4,5,6,7,8,9,10],
[11,12,13,14,15,16,17,18,19,20],
[21,22,23,24,25,26,27,28,29,30]])
print(A)
# Singular-value decomposition
U, s, VT = svd(A)
因为上面的“s”应该是(10)的形状,因为我们有10个特征,但是没有显示(3)。示例输出如下所示,我感到困惑。请解释一下,我们为什么去(3,)

让我们考虑另一个例子

A = array([[1, 2], [3, 4], [5, 6]])
print(A.shape)
# Singular-value decomposition
U, s, VT = svd(A)
Here “s” shape is shown as (2,)
这里的输出如下所示

(3, 2)
U shape  (3, 3)
s shape (2,)
VT shape  (2, 2)
我不明白为什么形状有差异。请使用expalin

将形状为(m x n)的矩阵a分解为

  • 形(m×m)的酉矩阵U
  • 形状为(m x n)的矩形对角矩阵σ
  • 形(nxn)的酉矩阵V
西格玛包含其主对角线上的所有奇异值。由于形状矩阵(mxn)在其主对角线上只包含min(m,n)元素,因此只有min(m,n)奇异值

(3, 2)
U shape  (3, 3)
s shape (2,)
VT shape  (2, 2)