Reputation: 1998
I don't have the memory to convert the entire list of sparse matrices into a numpy 2d array, and then convert that to a sparse matrix.
The regressor WILL accept the following:
X = sparse.csr_matrix( my_2D_Numpy_Matrix )
It doesn't accept (this is just an example):
X = []
for i in range(my_2D_Numpy_Matrix.shape[0]):
X.append(sparse.csr_matrix(my_2D_Numpy_Matrix[i,:]))
Upvotes: 0
Views: 92
Reputation: 755
You can merge sparse matrices without converting them to numpy matrix using sparse.vstack
X = sparse_list[0]
for mat in sparse_list[1:]:
X = sparse.vstack((X,mat))
Upvotes: 1