Decision trees' classes are wrapped in another array for some reason. I was
under the impression that I could just get ``clf.classes_`` from any old
classifier and it would be a nice list, but I guess I'm mistaken. It makes
it hard to write utilities...is this an oversight or a bug, or by design? I
haven't checked other classifiers.

from sklearn.tree import DecisionTreeClassifier
clf1 = DecisionTreeClassifier()

In [104]: clf1.classes_
Out[104]: [array([1, 2, 3])]


from sklearn.linear_model import SGDClassifier
clf2 = SGDClassifier()
clf2.fit([[1],[2],[3]], [1,2,3])

In [100]: clf2.classes_
Out[100]: array([1, 2, 3])




Thanks,
Doug
------------------------------------------------------------------------------
Keep yourself connected to Go Parallel: 
VERIFY Test and improve your parallel project with help from experts 
and peers. http://goparallel.sourceforge.net
_______________________________________________
Scikit-learn-general mailing list
Scikit-learn-general@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/scikit-learn-general

Reply via email to