There is no code to do it automatically, but you can use the following to get array of thresholds:
``` clf = DecisionTreeClassifier() clf.fit( datums, targets ) clf.tree_.thresholds ``` The full list of attributes you can call are (feature, threshold, impurity, n_node_samples, weighted_n_node_samples, value (the prediction), children_left, children_right). Does this help? On Tue, Aug 18, 2015 at 7:53 AM, Andreas Mueller <t3k...@gmail.com> wrote: > 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 > listScikit-learn-general@lists.sourceforge.nethttps://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 > >
------------------------------------------------------------------------------
_______________________________________________ Scikit-learn-general mailing list Scikit-learn-general@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/scikit-learn-general