Why Sklearn.decomposition.TruncatedSVD
's explained variance ratios are not ordered by singular values?
My code is below:
X = np.array([[1,1,1,1,0,0,0,0,0,0,0,0,0,0],
[0,0,1,1,1,1,1,1,1,0,0,0,0,0],
[0,0,0,0,0,0,1,1,1,1,1,1,0,0],
[0,0,0,0,0,0,0,0,0,0,1,1,1,1]])
svd = TruncatedSVD(n_components=4)
svd.fit(X4)
print(svd.explained_variance_ratio_)
print(svd.singular_values_)
and the results:
[0.17693405 0.46600983 0.21738089 0.13967523]
[3.1918354 2.39740372 1.83127499 1.30808033]
I heard that a singular value means how much the component can explain data, so I think explained variance ratios also are followed by the order of singular values.
But the ratios are not ordered by descending order.
Can someone explain why does it happen?
See Question&Answers more detail:
os