2016-10-17 14 views
1

私は以下のようにsklearn LabelSpreadingModelを使用しています:sklearn:半教師あり学習 - LabelSpreadingModelメモリエラー

label_spreading_model = LabelSpreading() 
model_s = label_spreading_model.fit(my_inputs, labels) 

をしかし、私は次のエラーを得た:

MemoryErrorTraceback (most recent call last) 
    <ipython-input-17-73adbf1fc908> in <module>() 
     11 
     12 label_spreading_model = LabelSpreading() 
    ---> 13 model_s = label_spreading_model.fit(my_inputs, labels) 

    /usr/local/lib/python2.7/dist-packages/sklearn/semi_supervised/label_propagation.pyc in fit(self, X, y) 
     224 
     225   # actual graph construction (implementations should override this) 
    --> 226   graph_matrix = self._build_graph() 
     227 
     228   # label construction 

    /usr/local/lib/python2.7/dist-packages/sklearn/semi_supervised/label_propagation.pyc in _build_graph(self) 
     455   affinity_matrix = self._get_kernel(self.X_) 
     456   laplacian = graph_laplacian(affinity_matrix, normed=True) 
    --> 457   laplacian = -laplacian 
     458   if sparse.isspmatrix(laplacian): 
     459    diag_mask = (laplacian.row == laplacian.col) 

    MemoryError: 

はのラプラシアンと間違って何かのように見えます私の入力行列。設定できるパラメータはありますか、このエラーを回避できる変更はありますか?ありがとう!

答えて

2

PCのメモリが不足していることは明らかです。

あなたが任意のパラメータを設定していないとして、RBFカーネルがデフォルトproof)で使用されています。

scikit-learn's docsからいくつか抜粋:たぶん

The RBF kernel will produce a fully connected graph which is represented in 
memory by a dense matrix. This matrix may be very large and combined with the 
cost of performing a full matrix multiplication calculation for each iteration 
of the algorithm can lead to prohibitively long running times 

以下(上記のドキュメントの次の文は)助けになります。

On the other hand, the KNN kernel will produce a much more memory-friendly 
sparse matrix which can drastically reduce running times. 

しかし、私はあなたのデータを、PC-設定を知っていないと共同。推測できるのは...

関連する問題