Skip to content

Instantly share code, notes, and snippets.

@haydarai
Last active February 2, 2017 12:08
Show Gist options
  • Save haydarai/561dabca6474ff97fd0a140a5d52147f to your computer and use it in GitHub Desktop.
Save haydarai/561dabca6474ff97fd0a140a5d52147f to your computer and use it in GitHub Desktop.
Perform 10-fold cross-validation to the dataset and display the accuracy
from sklearn.cross_validation import cross_val_score
dtc = DecisionTreeClassifier()
cv_scores = cross_val_score(dtc, all_inputs, all_classes, cv=10)
sns.distplot(cv_scores)
plt.title('Average score: {}'.format(np.mean(cv_scores)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment