tensorly
.partial_svd
- partial_svd(matrix, n_eigenvecs=None, flip=False, random_state=None, **kwargs)
Computes a fast partial SVD on matrix
If n_eigenvecs is specified, sparse eigendecomposition is used on either matrix.dot(matrix.T) or matrix.T.dot(matrix).
- Parameters
- matrixtensor
A 2D tensor.
- n_eigenvecsint, optional, default is None
If specified, number of eigen[vectors-values] to return.
- flipbool, default is False
If True, the SVD sign ambiguity is resolved by making the largest component in the columns of U, positive.
- random_state: {None, int, np.random.RandomState}
If specified, use it for sampling starting vector in a partial SVD(scipy.sparse.linalg.eigsh)
- **kwargsoptional
kwargs are used to absorb the difference of parameters among the other SVD functions
- Returns
- U2-D tensor, shape (matrix.shape[0], n_eigenvecs)
Contains the right singular vectors
- S1-D tensor, shape (n_eigenvecs, )
Contains the singular values of matrix
- V2-D tensor, shape (n_eigenvecs, matrix.shape[1])
Contains the left singular vectors