我有一个相当大的数据集(1841000*32 矩阵),我希望运行分层聚类算法。sklearn.cluster 中的 AgglomerativeClustering 类和 FeatureAgglomeration 类均给出以下错误。
---------------------------------------------------------------------------
MemoryError Traceback (most recent call last)
<ipython-input-10-85ab7b694cf1> in <module>()
1
2
----> 3 mat_red = manifold.SpectralEmbedding(n_components=2).fit_transform(mat)
4 clustering.fit(mat_red,y = None)
~/anaconda3/lib/python3.6/site-packages/sklearn/manifold/spectral_embedding_.py in fit_transform(self, X, y)
525 X_new : array-like, shape (n_samples, n_components)
526 """
--> 527 self.fit(X)
528 return self.embedding_
~/anaconda3/lib/python3.6/site-packages/sklearn/manifold/spectral_embedding_.py in fit(self, X, y)
498 "name or a callable. Got: %s") % self.affinity)
499
--> 500 affinity_matrix = self._get_affinity_matrix(X)
501 self.embedding_ = spectral_embedding(affinity_matrix,
502 n_components=self.n_components,
~/anaconda3/lib/python3.6/site-packages/sklearn/manifold/spectral_embedding_.py in _get_affinity_matrix(self, X, Y)
450 …Run Code Online (Sandbox Code Playgroud) python hierarchical-clustering python-3.x scikit-learn opencv3.0