Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from sklearn.metrics import confusion_matrix
- def plot_confusion_matrix(Y_test, Y_preds):
- conf_mat = confusion_matrix(Y_test, Y_preds)
- print(conf_mat)
- fig = plt.figure(figsize=(6,6))
- plt.matshow(conf_mat, cmap=plt.cm.Blues, fignum=1)
- plt.yticks(range(10), range(10))
- plt.xticks(range(10), range(10))
- plt.colorbar();
- for i in range(10):
- for j in range(10):
- plt.text(i-0.2,j+0.1, str(conf_mat[j, i]), color='tab:red')
- plot_confusion_matrix(Y_test, mlp_classifier.predict(X_test))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement