2013-06-20 53 views
0

假设我只有1个正面训练分类器。有没有什么方法可以通过scikit-learn来训练一个模型,只有一个积极的? (例如类似于示例性SVM)。scikit-learn的一次性学习

此刻,我有以下几点:

scores = [ 
    ('precision', precision_score), 
] 

for score_name, score_func in scores: 
    clf = GridSearchCV(SVC(C=1), tuned_parameters, score_func=score_func) 
    clf.fit(X[train], y[train]) 
    y_true, y_pred = y[test], clf.predict(X[test]) 

,但我得到了以下错误:

ValueError: The least populated class in y has only 2 members, which is too few. The minimum number of labels for any class cannot be less than k=3.

回答

3

没有模型专用于一个镜头在学习scikit学习。

此外,正如您应该在错误消息的完整回溯中看到的那样,GridSearchCV在内部使用交叉验证,因此您不能在没有至少2个正样本的数据集上使用它。