Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

python decision tree

# 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 :: i have two versions of python installed mac 
Python :: request post python 
Python :: example of break statement in python 
Python :: pandas filter column greater than 
Python :: python create a set of class 
Python :: python multiply each item in list 
Python :: type conversion python 
Python :: tuple in python 
Python :: creating methods in python 
Python :: dicionario python 
Python :: Python Regex Backslash “” 
Python :: how to extract zip file using python 
Python :: python strptime milliseconds 
Python :: convert price to float pandas 
Python :: pandas list comprehension 
Python :: re.search() 
Python :: pandas check if column is object type 
Python :: How to efficiently search for a pattern string within another bigger one, in Python? 
Python :: excel with python 
Python :: PHP echo multi lines Using Nowdoc variable 
Python :: matplotlib save figure without showing 
Python :: read dict txt python 
Python :: what is the weather today 
Python :: django add to database 
Python :: disable sns plot python 
Python :: Does np.tile Work in More Than 2 Dimensions 
Python :: python remove item from list 
Python :: pytonh leer txt y quitar tildes acentos 
Python :: install nsml python 
Python :: python map function 
ADD CONTENT
Topic
Content
Source link
Name
6+4 =