the classes_ attribute is not present in all classifiers and not consistent, as 
you noticed.
this is a known issue (see the issue tracker) and it would be great to address 
this.
I am not sure about the decision trees in particular.



Doug Coleman <doug.cole...@gmail.com> schrieb:

>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

-- 
Diese Nachricht wurde von meinem Android-Mobiltelefon mit K-9 Mail gesendet.
------------------------------------------------------------------------------
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