Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

decisiontreeclassifier sklearn

from sklearn.tree import DecisionTreeClassifier
Comment

python decision tree classifier

# Create Decision Tree classifer object
clf = DecisionTreeClassifier(criterion="entropy", max_depth=3)

# Train Decision Tree Classifer
clf = clf.fit(X_train,y_train)

#Predict the response for test dataset
y_pred = clf.predict(X_test)

# Model Accuracy, how often is the classifier correct?
print("Accuracy:",metrics.accuracy_score(y_test, y_pred))
Comment

PREVIOUS NEXT
Code Example
Python :: how to place image in tkinter 
Python :: django import model from another app 
Python :: get distance between 2 multidimentional point in python 
Python :: sklearn columntransformer 
Python :: select python version ubuntu 
Python :: import excel file to python 
Python :: python time execution 
Python :: pandas convert column to index 
Python :: how to join a string by new line out of a list python 
Python :: python print range 
Python :: django proper capitalization case jinja 
Python :: how to change voice of pyttsx3 
Python :: selenium proxy python chrome 
Python :: python how to unnest a nested list 
Python :: last element in dictionary python 
Python :: how to unzip files using zipfile module python 
Python :: python ceiling 
Python :: pytorch open image 
Python :: how to raise a error in python 
Python :: sns lineplot title 
Python :: python fiscal year prior 
Python :: dataframe show to semicolon python 
Python :: python matplotlib inline 
Python :: python divide every element in a list by a number 
Python :: pyspark import stringtype 
Python :: get text from url python last slash 
Python :: pyttsx3 speech to mp3 
Python :: create empty csv file in python 
Python :: how to make a alert box in python 
Python :: corona shape in python 
ADD CONTENT
Topic
Content
Source link
Name
1+3 =