Dear Developers, DecisionTreeClassifier.decision_path() as used here http://scikit-learn.org/dev/auto_examples/tree/unveil_tree_structure.html is giving the following error: AttributeError: 'DecisionTreeClassifier' object has no attribute 'decision_path' Kindly help. Thanks
That should be: node indicator = estimator.tree_.decision_path(X_test) PR welcome :) On Sun, Aug 28, 2016, 13:12 Ibrahim Dalal via scikit-learn < scikit-learn@python.org> wrote:
Dear Developers,
DecisionTreeClassifier.decision_path() as used here http://scikit-learn.org/dev/auto_examples/tree/unveil_tree_structure.html is giving the following error:
AttributeError: 'DecisionTreeClassifier' object has no attribute 'decision_path'
Kindly help.
Thanks _______________________________________________ scikit-learn mailing list scikit-learn@python.org https://mail.python.org/mailman/listinfo/scikit-learn
Hi, Is there a way to extract impurity value of a node in DecisionTreeClassifier? I am able to get this value in graph (using export_grapgviz), but can't figure out how to get this value in my code. Is there any attribute similar to estimator.tree_.children_left? Thanks On Mon, Aug 29, 2016 at 12:53 AM, Nelson Liu <nfliu@uw.edu> wrote:
That should be: node indicator = estimator.tree_.decision_path(X_test)
PR welcome :)
On Sun, Aug 28, 2016, 13:12 Ibrahim Dalal via scikit-learn < scikit-learn@python.org> wrote:
Dear Developers,
DecisionTreeClassifier.decision_path() as used here http://scikit-learn.org/dev/auto_examples/tree/unveil_tree_structure.html is giving the following error:
AttributeError: 'DecisionTreeClassifier' object has no attribute 'decision_path'
Kindly help.
Thanks _______________________________________________ scikit-learn mailing list scikit-learn@python.org https://mail.python.org/mailman/listinfo/scikit-learn
_______________________________________________ scikit-learn mailing list scikit-learn@python.org https://mail.python.org/mailman/listinfo/scikit-learn
Hi, Yes, it's estimator.tree_.impurity Nelson On Mon, Aug 29, 2016, 09:18 Ibrahim Dalal via scikit-learn < scikit-learn@python.org> wrote:
Hi,
Is there a way to extract impurity value of a node in DecisionTreeClassifier? I am able to get this value in graph (using export_grapgviz), but can't figure out how to get this value in my code. Is there any attribute similar to estimator.tree_.children_left?
Thanks
On Mon, Aug 29, 2016 at 12:53 AM, Nelson Liu <nfliu@uw.edu> wrote:
That should be: node indicator = estimator.tree_.decision_path(X_test)
PR welcome :)
On Sun, Aug 28, 2016, 13:12 Ibrahim Dalal via scikit-learn < scikit-learn@python.org> wrote:
Dear Developers,
DecisionTreeClassifier.decision_path() as used here http://scikit-learn.org/dev/auto_examples/tree/unveil_tree_structure.html is giving the following error:
AttributeError: 'DecisionTreeClassifier' object has no attribute 'decision_path'
Kindly help.
Thanks _______________________________________________ scikit-learn mailing list scikit-learn@python.org https://mail.python.org/mailman/listinfo/scikit-learn
_______________________________________________ scikit-learn mailing list scikit-learn@python.org https://mail.python.org/mailman/listinfo/scikit-learn
_______________________________________________ scikit-learn mailing list scikit-learn@python.org https://mail.python.org/mailman/listinfo/scikit-learn
Thanks Nelson. Is there any way to access number of training samples in a node? Thanks On Mon, Aug 29, 2016 at 8:53 PM, Nelson Liu <nfliu@uw.edu> wrote:
Hi, Yes, it's estimator.tree_.impurity
Nelson
On Mon, Aug 29, 2016, 09:18 Ibrahim Dalal via scikit-learn < scikit-learn@python.org> wrote:
Hi,
Is there a way to extract impurity value of a node in DecisionTreeClassifier? I am able to get this value in graph (using export_grapgviz), but can't figure out how to get this value in my code. Is there any attribute similar to estimator.tree_.children_left?
Thanks
On Mon, Aug 29, 2016 at 12:53 AM, Nelson Liu <nfliu@uw.edu> wrote:
That should be: node indicator = estimator.tree_.decision_path(X_test)
PR welcome :)
On Sun, Aug 28, 2016, 13:12 Ibrahim Dalal via scikit-learn < scikit-learn@python.org> wrote:
Dear Developers,
DecisionTreeClassifier.decision_path() as used here http://scikit-learn.org/dev/auto_examples/tree/unveil_ tree_structure.html is giving the following error:
AttributeError: 'DecisionTreeClassifier' object has no attribute 'decision_path'
Kindly help.
Thanks _______________________________________________ scikit-learn mailing list scikit-learn@python.org https://mail.python.org/mailman/listinfo/scikit-learn
_______________________________________________ scikit-learn mailing list scikit-learn@python.org https://mail.python.org/mailman/listinfo/scikit-learn
_______________________________________________ scikit-learn mailing list scikit-learn@python.org https://mail.python.org/mailman/listinfo/scikit-learn
_______________________________________________ scikit-learn mailing list scikit-learn@python.org https://mail.python.org/mailman/listinfo/scikit-learn
Hi, What does the estimator.tree_.value array represent? I looked up the source code but not able to get what it is. I am interested in the number of training samples of each class in a given tree node. Thanks On Mon, Aug 29, 2016 at 9:22 PM, Andreas Mueller <t3kcit@gmail.com> wrote:
On 08/28/2016 03:23 PM, Nelson Liu wrote:
That should be: node indicator = estimator.tree_.decision_path(X_test)
PR welcome :)
Was there a reason not to make this a "plot" example? Would it take too long? Not having run examples by CI is a pretty big maintenance burden.
_______________________________________________ scikit-learn mailing list scikit-learn@python.org https://mail.python.org/mailman/listinfo/scikit-learn
estimator.tree_.value gives the constant prediction of the tree at each node. Think of it as what the tree would output if that node was a leaf. I don't think we have a readily available way of checking the number of training samples of each class in a given tree node. The closest thing easily accessible is estimator.tree_.n_node_samples. Getting finer-grained counts of the number of samples in each class would require modifying the source code, I think. On Mon, Aug 29, 2016 at 8:06 PM Ibrahim Dalal via scikit-learn < scikit-learn@python.org> wrote:
Hi,
What does the estimator.tree_.value array represent? I looked up the source code but not able to get what it is. I am interested in the number of training samples of each class in a given tree node.
Thanks
On Mon, Aug 29, 2016 at 9:22 PM, Andreas Mueller <t3kcit@gmail.com> wrote:
On 08/28/2016 03:23 PM, Nelson Liu wrote:
That should be: node indicator = estimator.tree_.decision_path(X_test)
PR welcome :)
Was there a reason not to make this a "plot" example? Would it take too long? Not having run examples by CI is a pretty big maintenance burden.
_______________________________________________ scikit-learn mailing list scikit-learn@python.org https://mail.python.org/mailman/listinfo/scikit-learn
_______________________________________________ scikit-learn mailing list scikit-learn@python.org https://mail.python.org/mailman/listinfo/scikit-learn
Or just running estimator.tree_.apply(X_train) and inferring from there. On 30 August 2016 at 13:22, Nelson Liu <nfliu@uw.edu> wrote:
estimator.tree_.value gives the constant prediction of the tree at each node. Think of it as what the tree would output if that node was a leaf.
I don't think we have a readily available way of checking the number of training samples of each class in a given tree node. The closest thing easily accessible is estimator.tree_.n_node_samples. Getting finer-grained counts of the number of samples in each class would require modifying the source code, I think.
On Mon, Aug 29, 2016 at 8:06 PM Ibrahim Dalal via scikit-learn < scikit-learn@python.org> wrote:
Hi,
What does the estimator.tree_.value array represent? I looked up the source code but not able to get what it is. I am interested in the number of training samples of each class in a given tree node.
Thanks
On Mon, Aug 29, 2016 at 9:22 PM, Andreas Mueller <t3kcit@gmail.com> wrote:
On 08/28/2016 03:23 PM, Nelson Liu wrote:
That should be: node indicator = estimator.tree_.decision_path(X_test)
PR welcome :)
Was there a reason not to make this a "plot" example? Would it take too long? Not having run examples by CI is a pretty big maintenance burden.
_______________________________________________ scikit-learn mailing list scikit-learn@python.org https://mail.python.org/mailman/listinfo/scikit-learn
_______________________________________________ scikit-learn mailing list scikit-learn@python.org https://mail.python.org/mailman/listinfo/scikit-learn
_______________________________________________ scikit-learn mailing list scikit-learn@python.org https://mail.python.org/mailman/listinfo/scikit-learn
Oops, phone removed the underscore between the two words of the variable name but I think you get the point. Nelson On Sun, Aug 28, 2016, 13:12 Ibrahim Dalal via scikit-learn < scikit-learn@python.org> wrote:
Dear Developers,
DecisionTreeClassifier.decision_path() as used here http://scikit-learn.org/dev/auto_examples/tree/unveil_tree_structure.html is giving the following error:
AttributeError: 'DecisionTreeClassifier' object has no attribute 'decision_path'
Kindly help.
Thanks _______________________________________________ scikit-learn mailing list scikit-learn@python.org https://mail.python.org/mailman/listinfo/scikit-learn
participants (5)
-
Andreas Mueller -
Andy -
Ibrahim Dalal -
Joel Nothman -
Nelson Liu