Skip to main content

All Questions

0 votes
0 answers
76 views

ValueError: setting an array element with a sequence. In decisionTreeClassifier fit

I have the following code, I'm just trying to teach myself how to use a machine learning model. import ast import csv import pandas as pd import numpy as np from sklearn.tree import ...
Malelizarazo's user avatar
1 vote
1 answer
409 views

Get 100% accuracy score on Decision tree model

I got 100% accuracy on my decision tree using decision tree algorithm but only got 75% accuracy on random forest Is there something wrong with my model or is decision tree best suited for the dataset ...
Jack Tam's user avatar
1 vote
1 answer
479 views

IndexError: tuple index out of range in LabelEncoder Sklearn

I would like to train a DecisionTree using sklearn Pipeline. My goal is to predict the 'language' column, using the 'tweet' as ngram transformed features. However I am not able to make the ...
Chiara's user avatar
  • 510
0 votes
1 answer
1k views

Decision Tree Classifier took 16min to fit

So, for some reasons, It took my laptop to 16min to fit data into DecisionTreeClassifier. It usually take like 1 sec to fit into other type of machine learning model. Anyone can help me with what is ...
FastBoi's user avatar
  • 163
1 vote
1 answer
228 views

How to input custom metric in RandomizedSearchCV?

I need to choose best model by the metice smape_final. For this, I wrote a function: def smape(A, F): return 100/len(A) * np.sum(2 * np.abs(F - A) / (np.abs(A) + np.abs(F))) which I use later: ...
Nikita Tsekhanovich's user avatar
0 votes
0 answers
64 views

Fix the execution error in the decision tree in Python

I want to implement the decision tree in my database but I got the following error. Can anyone guide me? df = pd.read_csv('sample.csv') X_train, X_test, y_train, y_test = train_test_split(df, df, ...
user12217822's user avatar
0 votes
0 answers
80 views

How to make a shallower classification tree with OK score?

I'm new to Phyton and I wish to understand how I can shallow my classification tree maintaining an OK score. I have a data file with Survived, Sex, Age, and Class from a boat that sunk. I created a ...
Ricardo Ortega's user avatar
0 votes
1 answer
9k views

ValueError: could not convert string to float: 'what' (Sklearn), How to use the labelencoder?

I have two training sets input and output set X = df['First Word'] y = df['Answers'] When I tried: from sklearn.tree import DecisionTreeClassifier model = DecisionTreeClassifier() model.fit(X,y) ...
Atom Store's user avatar
  • 1,016
0 votes
0 answers
90 views

What could cause -->TypeError: float() argument must be a string or a number, not 'method'

trying my hands on the kaggle titanic competition; I ran the code below and got the error message in the title. What could I be doing wrong? # run decision tree model on the data and printing the ...
Geoff's user avatar
  • 9
0 votes
0 answers
118 views

Decision tree algorithms in Python

I wanted to classify a few datasets with ID3, C4.5, CHAID and CART Decision Trees, but the sklearn library only uses the CART and ID3 algorithms (by changing the 'criterion' parameter). Could anyone ...
Silent Guardian's user avatar
0 votes
2 answers
1k views

how to i handle a multiclass decision tree?

I am new to python & ML, but I am trying to use sklearn to build a decision tree. I have many categorical features and I have transformed them into numerical variables. However, my target feature ...
Kenia Cevallos's user avatar
1 vote
1 answer
850 views

Predicted class along with its corresponding probability

I have built a machine learning model using maxvoting(Decision tree, Random Forest, Logistic Regression) classifier. For which i have have the input as { "Salary": 50000, "Current loans": 15000, "...
syed jameer's user avatar
2 votes
2 answers
800 views

Get prediction confidence through Decision Tree Regression in sklearn

Is there a way I can attach some sort of confidence with my predictions from Decision Tree Regression output in python? from sklearn.tree import DecisionTreeRegressor dt = DecisionTreeRegressor(...
ayadav's user avatar
  • 75
0 votes
1 answer
31 views

Is there a way to see the order of nodes categorizing data in decision trees when not allowed to install graphviz nor pydotplus?

I need to know the order of the nodes and the scores for each one, once I have ran the decision tree model. As I'm working in my office computer, the installations are very restricted and I'm not ...
grace's user avatar
  • 72
1 vote
1 answer
556 views

Extracting rules to predict child nodes or probability scores in a Decision Tree [closed]

I am relatively new to Python implementation of Decision Tree. I am trying to extract rules to predict only child nodes and I need it to be able to predict probability scores (not just final ...
Sveta's user avatar
  • 171

15 30 50 per page