Ich habe 3 dünn besetzte Matrizen:Wie stacked mehrere dünn besetzte Matrizen (Feature-Matrizen)?
In [39]:
mat1
Out[39]:
(1, 878049)
<1x878049 sparse matrix of type '<type 'numpy.int64'>'
with 878048 stored elements in Compressed Sparse Row format>
In [37]:
mat2
Out[37]:
(1, 878049)
<1x878049 sparse matrix of type '<type 'numpy.int64'>'
with 744315 stored elements in Compressed Sparse Row format>
In [35]:
mat3
Out[35]:
(1, 878049)
<1x878049 sparse matrix of type '<type 'numpy.int64'>'
with 788618 stored elements in Compressed Sparse Row format>
Vom documentation, ich gelesen, dass es zu hstack
, möglich ist vstack
und concatenate
sie solche Art von Matrizen. Also habe ich versucht, sie hstack
:
import numpy as np
matrix1 = np.hstack([[address_feature, dayweek_feature]]).T
matrix2 = np.vstack([[matrix1, pddis_feature]]).T
X = matrix2
jedoch die Abmessungen stimmen nicht überein:
In [41]:
X_combined_features.shape
Out[41]:
(2, 1)
Bitte beachte, dass ich eine solche Matrizen bin Stapeln, da ich sie mit einem Scikit-Learn verwenden möchten Klassifikationsalgorithmus . Daher Wie sollte ich hstack
eine Reihe von verschiedenen dünn besetzten Matrizen?.
Danke für die Hilfe, große Antwort !. –