I am using truncated SVD from scikit-learn
package.
In the definition of SVD, an original matrix A is approxmated as a product A ≈ UΣV* where U and V have orthonormal columns, and Σ is non-negative diagonal.
I need to get the U, Σ and V* matrices.
Looking at the source code here I found out that V* is stored in self.components_
field after calling fit_transform
.
Is it possible to get U and Σ matrices?
My code:
import sklearn.decomposition as skd
import numpy as np
matrix = np.random.random((20,20))
trsvd = skd.TruncatedSVD(n_components=15)
transformed = trsvd.fit_transform(matrix)
VT = trsvd.components_