2013-08-22 75 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_屬性中。 閱讀源代碼後發現它。