This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from matplotlib.ticker import PercentFormatter | |
import matplotlib.pyplot as plt | |
import seaborn as sns | |
from sklearn.metrics import confusion_matrix | |
def cm_analysis(y_true, y_pred, filename, labels, classes, ymap=None, figsize=(17,17)): | |
""" | |
Generate matrix plot of confusion matrix with pretty annotations. | |
The plot image is saved to disk. | |
args: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def set_plot_props(font_size: int = 14): | |
"""This function sets some plot configurations for the matplotlib.""" | |
plt.rcParams["axes.prop_cycle"] = cycler("color", plt.get_cmap("tab10").colors) | |
plt.rcParams["figure.dpi"] = 150 | |
plt.rcParams["savefig.dpi"] = 300 | |
plt.rcParams["lines.linewidth"] = 2.5 | |
plt.rcParams["font.size"] = font_size |