Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

python machine learning model

# 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 :: django models 
Python :: create tuples python 
Python :: how to save frames in form of video in opencv python 
Python :: How do I plot a csv file in Jupyter notebook? 
Python :: %d%m%Y python 
Python :: python check if string or list 
Python :: python with 
Python :: python portfolio projects 
Python :: repeat rows in a pandas dataframe based on column value 
Python :: binary search recursive python 
Python :: add list of dictionaries to pandas dataframe 
Python :: python integer to string format 
Python :: coinflip 
Python :: how to check if given primary key exists in django model 
Python :: len python meaning 
Python :: Insert list element at specific index 
Python :: python library to convert decimal into octal and hexadecimal 
Python :: double a value in a list python 
Python :: how to speed up python code 
Python :: find common string in two strings python 
Python :: python readlines strip 
Python :: how to get a row of a dataframe with subset columns in python 
Python :: // meaning in python 
Python :: scikit learn library in python 
Python :: discordpy make all inputs lowercase 
Python :: python datetime with day date suffix format 
Python :: how to do merge sort in python 
Python :: python jointly shuffle list 
Python :: First Python Program: Hello World 
Python :: Example code of while loop in python 
ADD CONTENT
Topic
Content
Source link
Name
7+3 =