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
0
votes
2 answers

NotFittedError: This DecisionTreeClassifier instance is not fitted yet

Am new to ML and trying to run a decision tree based model I tried the below X = df[['Quantity']] y = df[['label']] params = {'max_depth':[2,3,4], 'min_samples_split':[2,3,5,10]} clf_dt = DecisionTreeClassifier() clf = GridSearchCV(clf_dt,…
0
votes
1 answer

Classification models which utilise multi-level columns - hierarchical information

I am looking for some robust classification/clustering models, e.g. decision trees, that would utilise hierarchical information present in the dataset. The dataset consists of unique rows (customer ID's) and purchased products (columns). The columns…
0
votes
1 answer

Create dropdown menu that replaces href with a certain json file

Context: I'm trying to create a simply project (a decision tree) and I'd like to know how could I create a drop down menu so that the user can select a specific option and retrieve a output from a json file. This is the HTML…
user17153595
0
votes
1 answer

Plotting variable importance for CART in R using bar graphs

How can I plot variable importance for a decision tree (CART) in R? Since I am new to R, I need the code (if possible, I want to plot the relative importance score for each variable using bar graphs). Thanks in advance!
0
votes
1 answer

All classifiers are locked in weka

I want to start text classifying a database and all classifiers are locked and i can't use any of them, i've used stringtowordVector filter for them to open and they're still locked and this is my arff file @relation emails @attribute email…
0
votes
0 answers

Decision Tree in R is not splitting

I am trying to split my data into categories to understand which groups have more probability of being "Default". Therefore I want to use a decision tree. My data has 809054 observations and 8 variables. And if I consider just a small sample of my…
Mariana da Costa
  • 173
  • 2
  • 12
0
votes
2 answers

NLP text classification CountVectorizer Shape Error

I have a text dataset which has one column for reviews and another column for labels. I want to build a decision tree model by using that dataset, I used vectorizer but it gives ValueError: Number of labels=37500 does not match number of samples=1 …
0
votes
1 answer

How to return all leaves in a recursive tree

I'm trying to create a function that will return all the leaves in my recursive tree. I saw many other posts about it but I couldn't modify it to my own code. I am trying to make like a decision tree. This is my code: class Node: def __init__(self,…
0
votes
1 answer

Is it possible to sort a bootstrapped array in `O(n)` knowing the original array's order

Summary: I have an array x of length n and can run all kinds of O(nlog(n)) operations on x and cache results. E.g. I can pre-compute indices = argsort(x) and order = argsort(argsort(x)). Now, given sample, which is an array of indices 0 to n of…
0
votes
1 answer

Iterating through tree datastructure using Treelib (Python)

I created some nodes by a Node-class and added them to a tree using Treelib. class Node(object): def __init__(self, id, label, parent, type): self.id = id self.label = label self.parent = parent self.type =…
Baflora
  • 119
  • 9
0
votes
1 answer

"Input contains NaN, infinity or a value too large for dtype('float32')" when I train a DecisionTreeClassifier

I'm trying to code a Decision Tree method for the data in an exoplanet catalogue. It's a worskhop for one of the courses of my Master's studies. I have writen this in an Jupyter Notebook import matplotlib.pyplot as plt import numpy as np import…
Fabio
  • 35
  • 1
  • 1
  • 6
0
votes
0 answers

Having trouble finding a python package for genetic decision trees with custom loss functions

Has anyone come across such a package? If not, are there any packages I could use to build it from?
helloimgeorgia
  • 311
  • 1
  • 10
0
votes
1 answer

Cluster and Decision Tree

I'm struggling to do some analysis using R: up until now I've done some clustering and decisional trees. I would like to use only ONE variable to build up the tree but it does not seem possible with mclust::Mclust(). Theoretically it shouldn't be a…
Filippo
  • 33
  • 1
  • 7
0
votes
2 answers

Decision Tree query in Gremlin

I have simplified a decision graph. It starts with begin vertex and ends with decision. My aim is to calculate the sum of a score (score associated with vertex) while traveling different paths (to reach decision vertex). The input to Graph is…
gremlin
  • 1
  • 1
0
votes
1 answer

sklearn decision tree: get records at each node and leaf (**efficently**)

I am training a Decision Tree classifier on some pandas data-frame X. clf = DecisionTreeClassifier() clf = clf.fit(X, y) Now I walk the tree clf.tree_ and want to get the records (preferably as a data-frame) that belong to that inner node or leaf.…
mibm
  • 1,328
  • 2
  • 13
  • 23
1 2 3
99
100