scikit-learnのsemi-supervised回帰タスクに伝播を使用できますか? そのAPIによれば、答えはYESです。 scikit-learnによる回帰のための半教師あり学習
ただし、次のコードを実行しようとすると、エラーメッセージが表示されます。
from sklearn import datasets
from sklearn.semi_supervised import label_propagation
import numpy as np
rng=np.random.RandomState(0)
boston = datasets.load_boston()
X=boston.data
y=boston.target
y_30=np.copy(y)
y_30[rng.rand(len(y))<0.3]=-999
label_propagation.LabelSpreading().fit(X,y_30)
それはその "ValueErrorを:不明なラベルタイプ: '連続'" を示しています。label_propagation.LabelSpreadingで()フィット(X、y_30)ラインを。
問題をどのように解決すればよいですか?どうもありがとう。 「
理論的にはcheck_classification_targets(y)
# actual graph construction (implementations should override this)
graph_matrix = self._build_graph()
# label construction
# construct a categorical distribution for classification only
classes = np.unique(y)
classes = (classes[classes != -1])
あなたが「check_classification_targets」コールを削除して使用することができます