reiinakano / scikit-plot

An intuitive library to add plotting functionality to scikit-learn objects.
MIT License
2.43k stars 285 forks source link

add hide_counts parameter to plot_confusion_matrix() #90

Closed echan5 closed 6 years ago

echan5 commented 6 years ago

This pull request adds a hide_counts parameter to the plot_confusion_matrix() function to allow for disabling of the overlaying of count text on the plot.

Sample code for testing:

import matplotlib.pyplot as plt
import scikitplot as skplt
from sklearn.datasets import load_digits
from sklearn.ensemble import RandomForestClassifier
from sklearn.model_selection import cross_val_predict

X, y = load_digits(return_X_y=True)
random_forest_clf = RandomForestClassifier(n_estimators=5, max_depth=5, random_state=1)
predictions = cross_val_predict(random_forest_clf, X, y)

skplt.metrics.plot_confusion_matrix(y, predictions, hide_counts=True)
plt.show()
echan5 commented 6 years ago

Test added - thanks!

reiinakano commented 6 years ago

Thanks @echan5 !!