Skip to content

Instantly share code, notes, and snippets.

@nitin-bommi
Created June 18, 2020 14:17
Show Gist options
  • Save nitin-bommi/3aaf3bfc30cbe827ccbf00f9c939a153 to your computer and use it in GitHub Desktop.
Save nitin-bommi/3aaf3bfc30cbe827ccbf00f9c939a153 to your computer and use it in GitHub Desktop.
interpreting confusion matrix
# Creating some predictions.
from sklearn.model_selection import cross_val_predict
y_train_pred = cross_val_predict(sgd_clf, X_train, y_train_5, cv=3)
"""
You could make predictions on the test set, but use the test set only at the very end of your project, once you have a classifier that you are ready to launch.
"""
# Constructing the confusion matrix.
from sklearn.metrics import confusion_matrix
confusion_matrix(y_train_5, y_train_pred)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment