2013-08-22 76 views

回答

7

有一个classes_字段。

>>> from sklearn import svm 
>>> clt = svm.SVC() 
>>> clt.fit([[1],[2],[3]], ["a","b","a"]) 
SVC(C=1.0, cache_size=200, class_weight=None, coef0=0.0, degree=3, gamma=0.0, 
    kernel='rbf', max_iter=-1, probability=False, shrinking=True, tol=0.001, 
    verbose=False) 
>>> clt.classes_ 
array(['a', 'b'], 
     dtype='|S2') 
+0

是的,我也找到了。谢谢! 我想知道他们为什么不把它放到文档中。 – justhalf

+0

其实他们把它!但是,它并没有单独的条目,而是将其作为'labels_'属性的更改 – justhalf

1

我发现它,它隐藏在对象的classes_属性中。 阅读源代码后发现它。