Re: [Scikit-learn-general] Finding a corresponding leaf node for each data point in a decision tree

2015-05-26 Thread Kittipat Kampa
Got it. Thanks for the clarification, Andreas! -Kittipat -- ___ Scikit-learn-general mailing list Scikit-learn-general@lists.sourceforge.net

Re: [Scikit-learn-general] Finding a corresponding leaf node for each data point in a decision tree

2015-05-26 Thread Andreas Mueller
Actually with the newest version Gilles meant the dev version 0.17-dev that is not released yet. So with 0.16.1, your way (manual conversion) is the right way, and with using the dev version or after the release, you can just do tree.apply(X). On 05/25/2015 12:33 PM, Kittipat Kampa wrote: Hi

Re: [Scikit-learn-general] Finding a corresponding leaf node for each data point in a decision tree

2015-05-25 Thread Kittipat Kampa
Hi Gilles, I just realized that the version of scikit-learn when I wrote the original email is 0.15.2. To follow your suggestion, I updated the scikit-learn to version 0.16.1 and tried the following commands. Finally it worked and here is what I found: clf.apply(X_train), which gives the error

Re: [Scikit-learn-general] Finding a corresponding leaf node for each data point in a decision tree

2015-05-24 Thread Gilles Louppe
Hi, Since the last version, scikit-learn provides an `apply` method for the classifier itself, hence preventing users from shooting themselves in the foot :) So basically, you can replace clf.tree_.apply(X_train) with clf..apply(X_train) and it should work. Hope this helps, Gilles On 23 May

[Scikit-learn-general] Finding a corresponding leaf node for each data point in a decision tree

2015-05-23 Thread Kittipat Kampa
Hi everyone, I'm using decision tree classifier from the scikit-learn package in python 3.4, and I want to get the corresponding leaf node id for each of my input data point. For example, my input data array (three records, 4d each) looks like this: array([[ 5.1, 3.5, 1.4, 0.2], [