I'm not aware of any ready-made code. But you can just get the boolean matrix by using ``apply`` and a one-hot encoder. Why are you interested in a single leave? the query seems to be able to return "only" a single boolean. It is probably more efficient to traverse the full tree for each data point if you are interested in all the leafs.

On 08/18/2015 11:39 AM, Rex X wrote:
Hi everyone,

Is it possible to extract the decision tree rule associated with each leaf node into a Pandas Dataframe query <http://pandas.pydata.org/pandas-docs/stable/generated/pandas.DataFrame.query.html>? So that one can view the corresponding Dataframe content by feeding in the decision rule.

Best,
Rex


------------------------------------------------------------------------------


_______________________________________________
Scikit-learn-general mailing list
Scikit-learn-general@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/scikit-learn-general

------------------------------------------------------------------------------
_______________________________________________
Scikit-learn-general mailing list
Scikit-learn-general@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/scikit-learn-general

Reply via email to