import scipy.sparse.linalg as ssl
import numpy as np
matrix = np.random.random((20, 20))
num_components = 2
u, s, v = ssl.svds(matrix, k=k)
X = u.dot(np.diag(s))
Get U, Sigma, V* matrix from Truncated SVD in scikit-learn