Answered step by step
Verified Expert Solution
Question
1 Approved Answer
I'm trying to implement the Decision Tree Machine Learning Algoin Python but keep on getting this error. How Do I fix this error in Python?
I'm trying to implement the Decision Tree Machine Learning Algoin Python but keep on getting this error.
How Do I fix this error in Python?
#DECISION TREE import pandas as pd from sklearn.tree import DecisionTreeClassifier # Import Decision Tree Classifier from sklearn.model_selection import train_test_split # Import train_test_split function from sklearn import metrics #Import scikit-learn metrics module for accuracy calculation clf = DecisionTree Classifier() # Train Decision Tree Classifer clf = clf.fit(x train, y train) #Predict the response for test dataset y_pred = clf.predict(X_test) Traceback (most recent call last) ValueError in () 9 10 # Train Decision Tree Classifer ---> 11 clf = clf.fit(x_train, y_train) 12 13 #Predict the response for test dataset 2 frames /usr/local/lib/python3.7/dist-packages/sklearn/utils/multiclass.py in check_classification_targets(y) 195 196 ]: --> 197 198 199 "multilabel-sequences", raise ValueError("Unknown label type: %r" % y_type) ValueError: Unknown label type: 'continuous'
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started