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
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
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
2 votes
1 answer
15k views

How to get feature importance in Decision Tree?

I have a dataset of reviews which has a class label of positive/negative. I am applying Decision Tree to that reviews dataset. Firstly, I am converting into a Bag of words. Here sorted_data['Text'] is ...
merkle's user avatar
  • 1,825
10 votes
2 answers
8k views

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 ...
smian's user avatar
  • 101
1 vote
1 answer
507 views

Sklearn DecisionTreeclassifier returning impossible value for split

I'm trying to implement a DecisionTreeClassifier from sklearn with a DataFrame (pandas), but it returns some weird values when splitting my data. My dataset contains 3 columns with Pearsons ...
Bella's user avatar
  • 414

15 30 50 per page