使用numpy的SVD计算中的奇异值

问题描述 投票:0回答:1

我有一个要问的问题

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个特征,因此应为shape(10,),但显示为(3,)。示例输出如下所示,我很困惑。请解释为什么我们要去(3,)

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

让我们考虑另一个示例

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)

我不明白为什么形状有所不同。请解释

numpy svd
1个回答
0
投票

[看structure of Sigma,我们可以看到任何矩阵最多只有min(A.shape)个奇异值。

© www.soinside.com 2019 - 2024. All rights reserved.