Questions tagged [decision-tree]

A decision tree is a decision support tool that uses a tree-like graph or model of decisions and their possible consequences, including chance event outcomes, resource costs, and utility. It is one way to display an algorithm.

Decision Tree could be just a graphical tool or the learning algorithm in a post.

2545 questions
10
votes
2 answers

Getting decision path to a node in sklearn

I wanted the decision path (i.e the set of rules) from the root node to a given node (which I supply) in a decision tree (DecisionTreeClassifier) in scikit-learn. clf.decision_path specifies the nodes a sample goes through, which may help in getting…
smian
  • 101
  • 1
  • 5
10
votes
4 answers

Decision Tree Learning and Impurity

There are three ways to measure impurity: What are the differences and appropriate use cases for each method?
Jony
  • 6,694
  • 20
  • 61
  • 71
10
votes
3 answers

Decision trees and rule engines (Drools)

In the application that I'm working on right now, I need to periodically check eligibility of tens of thousands of objects for some kind of a service. The decision diagram itself is in the following form, just way larger: In each of the end nodes…
John Manak
  • 13,328
  • 29
  • 78
  • 119
10
votes
1 answer

DecisionTreeClassifier predict_proba returns 0 or 1

I m trying to use the decision tree classified to identify two classes (renamed 0 and 1) based on certain parameters. I train it using a dataset and then run it on the "test dataset". When I try to calculate the probability for each data point in…
akaur
  • 389
  • 1
  • 6
  • 22
10
votes
3 answers

Scikit-Learn Decision Tree: Probability of prediction being a or b?

I have a basic decision tree classifier with Scikit-Learn: #Used to determine men from women based on height and shoe size from sklearn import tree #height and shoe size X =…
10
votes
3 answers

Determine WHY Features Are Important in Decision Tree Models

Often-times stakeholders don't want a black-box model that's good at predicting; they want insights about features to have a better understanding about their business, and so they can explain it to others. When we inspect the feature importance of…
Jarad
  • 17,409
  • 19
  • 95
  • 154
10
votes
1 answer

Where does scikit-learn hold the decision labels of each leaf node in its tree structure?

I have trained a random forest model using scikit-learn and now I want to save its tree structures in a text file so I can use it elsewhere. According to this link a tree object consist of a number of parallel arrays each one hold some information…
whoAmI
  • 358
  • 4
  • 16
10
votes
1 answer

Get decision tree rule/path pattern for every row of predicted dataset for rpart/ctree package in R

I have built a decision tree model in R using rpart and ctree. I also have predicted a new dataset using the built model and got predicted probabilities and classes. However, I would like to extract the rule/path, in a single string, for every…
arindam adak
  • 101
  • 1
  • 6
10
votes
1 answer

Data Prediction using Decision Tree of rpart

I am using R to classify a data-frame called 'd' containing data structured like below: The data has 576666 rows and the column "classLabel" has a factor of 3 levels: ONE, TWO, THREE. I am making a decision tree using rpart: fitTree =…
Saba Jamalian
  • 750
  • 2
  • 10
  • 24
10
votes
3 answers

Save a decision tree model in scikit

I'm building a decision tree using Scikit-Learn in Python. I've trained the model on a particular dataset and now I want to save this decision tree so that it can be used later (on a new dataset). Anyone knows how to do this?
nEO
  • 5,305
  • 3
  • 21
  • 25
10
votes
4 answers

TicTacToe AI Making Incorrect Decisions

A little background: as a way to learn multinode trees in C++, I decided to generate all possible TicTacToe boards and store them in a tree such that the branch beginning at a node are all boards that can follow from that node, and the children of a…
10
votes
2 answers

What is plurality classification in decision trees?

I am new to the field of AI and am reading about decision trees. I am referring to the AIMA book which is pretty much the standard Intro to AI book recommended. In the chapter on decision trees, they discuss in the book a case wherein after the…
anonuser0428
  • 11,789
  • 22
  • 63
  • 86
9
votes
3 answers

Plotting decision tree results from tidymodels

I have managed to build a decision tree model using the tidymodels package but I am unsure how to pull the results and plot the tree. I know I can use the rpart and rpart.plot packages to achieve the same thing but I would rather use tidymodels as…
Edgar Zamora
  • 456
  • 3
  • 11
9
votes
3 answers

Access trees and nodes from LightGBM model

In sci-kit learn, it's possible to access the entire tree structure, that is, each node of the tree. This allows to explore the attributes used at each split of the tree and which values are used for the test The binary tree structure has 5 nodes…
Titus Pullo
  • 3,751
  • 15
  • 45
  • 65
9
votes
1 answer

Working with decision trees

I know tl;dr; I'll try to explain my problem without bothering you with ton's of crappy code. I'm working on a school assignment. We have pictures of smurfs and we have to find them with foreground background analysis. I have a Decision Tree in java…