Skip to content

Instantly share code, notes, and snippets.

@uds5501
Created July 28, 2018 18:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save uds5501/42c96e1108907075966b3093e88d3dde to your computer and use it in GitHub Desktop.
Save uds5501/42c96e1108907075966b3093e88d3dde to your computer and use it in GitHub Desktop.
for blog post 2
from sklearn.tree import DecisionTreeClassifier
myClassifier2 = DecisionTreeClassifier(max_depth = 5, min_samples_leaf = 2)
myClassifier2.fit(X_train, y_train)
predictions2 = myClassifier2.predict(X_test)
cnf2 = confusion_matrix(y_test, predictions2)
score2 = accuracy_score(y_test, predictions2)
print ("Confusion Matrix for our Decision Tree classifier is :\n ", cnf2)
print("While the accuracy score for the same is %.2f percent" % (score2 * 100))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment