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.

2224 questions
13
votes
1 answer

Display more attributes in the decision tree

I am currently viewing the decision tree using the following code. Is there a way that we can export some calculated fields as output too? For example, is it possible to display the sum of an input attribute at each node, i.e. sum of feature 1 from…
13
votes
1 answer

How to access weighting of indiviual decision trees in xgboost?

I'm using xgboost for ranking with param = {'objective':'rank:pairwise', 'booster':'gbtree'} As I understand gradient boosting works by calculating the weighted sum of the learned decision trees. How can I access the weights that are assigned to…
саша
  • 502
  • 5
  • 18
13
votes
3 answers

Data Driven Rules Engine - Drools

I have been evaluating Drools as a Rules Engine for use in our Business Web Application. My use case is a Order Management Application. And the rules are of following kind: - If User Type is "SPECIAL" give an extra 5% discount. - If User has made…
Jasper
  • 7,524
  • 24
  • 87
  • 131
13
votes
1 answer

How to prune a tree in R?

I'm doing a classification using rpart in R. The tree model is trained by: > tree <- rpart(activity ~ . , data=trainData) > pData1 <- predict(tree, testData, type="class") The accuracy for this tree model is: >…
zfz
  • 1,535
  • 1
  • 20
  • 43
12
votes
1 answer

result of rpart is a root, but data shows Information Gain

I have a dataset with an event rate of less than 3% (i.e. there are about 700 records with class 1 and 27000 records with class 0). ID V1 V2 V3 V5 V6 Target SDataID3 161 ONE 1 FOUR 0 0 SDataID4 11 TWO 2 …
12
votes
1 answer

Library to generate a decision tree

Is there a C# Library to generate a decision tree from a datatable and then use it to predict missing data? I did some researches but did not find any C# library that can generate a decision tree from a set of data. Any help is greatly…
Youssef
  • 9,032
  • 35
  • 118
  • 192
11
votes
3 answers

C++ Decision Tree Implementation Question: Think In Code

I've been coding for a few years but I still haven't gotten the hang of pseudo-coding or actually thinking things out in code yet. Due to this problem, I'm having trouble figuring out exactly what to do in creating a learning Decision Tree. Here…
CodingImagination
  • 135
  • 1
  • 1
  • 11
11
votes
4 answers

displaying scikit decision tree figure in jupyter notebook

I am currently creating a machine learning jupyter notebook as a small project and wanted to display my decision trees. However, all options I can find are to export the graphics and then load a picture, which is rather complicated. Therefore, I…
11
votes
3 answers

Feature importances - Bagging, scikit-learn

For a project I am comparing a number of decision trees, using the regression algorithms (Random Forest, Extra Trees, Adaboost and Bagging) of scikit-learn. To compare and interpret them I use the feature importance , though for the bagging decision…
11
votes
1 answer

How to explain feature importance after one-hot encode used for decision tree

I know decision tree has feature_importance attribute calculated by Gini and it could be used to check which features are more important. However, for application in scikit-learn or Spark, it only accepts numeric attribute, so I have to transfer…
linpingta
  • 1,852
  • 1
  • 15
  • 33
11
votes
2 answers

What is the output of clf.tree_.feature?

I observed that scikit-learn clf.tree_.feature occasional return negative values. For example -2. As far as I understand clf.tree_.feature is supposed to return sequential order of the features. In case we have array of feature names…
user1700890
  • 5,474
  • 13
  • 63
  • 141
11
votes
3 answers

Python, PyDot and DecisionTree

I'm trying to visualize my DecisionTree, but getting the error The code is: X = [i[1:] for i in dataset]#attribute y = [i[0] for i in dataset] clf = tree.DecisionTreeClassifier() dot_data = StringIO() tree.export_graphviz(clf.fit(train_X, train_y),…
Polly
  • 857
  • 2
  • 12
  • 21
11
votes
1 answer

Decision Tree in Matlab

I saw the help in Matlab, but they have provided an example without explaining how to use the parameters in the 'classregtree' function. Any help to explain the use of 'classregtree' with its parameters will be appreciated.
user238469
11
votes
2 answers

Best learning algorithm to make a decision tree in java?

I have a datasets with information like age, city, age of children, ... and a result (confirm, accept). To help modelisation of "workflow", I want to create automatically a decision tree based on previous datasets. I have take a look at…
X-Blaster
  • 1,581
  • 3
  • 14
  • 31
11
votes
2 answers

pydot: is it possible to plot two different nodes with the same string in them?

I'm using pydot in order to draw graphs in python. I'd like to represent a decision tree, say something like (a1,a2,a3 are attributes and two classes are 0 and 1: a1>3 / \ a2>10 a3>-7 / \ / \ 1 0 1 0 However,…
ScienceFriction
  • 1,440
  • 2
  • 17
  • 28