sklearn GMM raises “ValueError: setting an array element with a sequence.” on sparse matrix
问题 I am attempting to cluster a set of data points that are represented as a sparse scipy matrix, X. That is, >>> print type(X) <class 'scipy.sparse.csr.csr_matrix'> >>> print X.shape (57, 1038) >>> print X[0] (0, 223) 0.471313296962 (0, 420) 0.621222153695 (0, 1030) 0.442688836467 (0, 124) 0.442688836467 When I feed this matrix into an sklearn.mixture.GMM model, however, it raises the following ValueError: File "/Library/Python/2.7/site-packages/sklearn/mixture/gmm.py", line 423, in fit X = np