This link has a tutorial that shows how to plot different metrics for test and training data by epochs. Please check the output of plot_metrics(baseline_history)
I only have two metrics to print I copied the plotting part and need help with below
How to change color of test line to red? I tried
plt.plot(history.epoch, history.history['val_'+metric], color=colors['r'], linestyle="--", label='Val')But got the errorTypeError: list indices must be integers or slices, not strhow to ensure the plain background. For some reason I am getting grey color background with white lines
my code and output below
#plotting def plot_metrics(history): metrics = ['loss','acc'] for n, metric in enumerate(metrics): name = metric.replace("_"," ").capitalize() plt.subplot(2,2,n+1) plt.plot(history.epoch, history.history[metric], color=colors[0], label='Train') plt.plot(history.epoch, history.history['val_'+metric], color=colors[9], linestyle="--", label='Val') plt.xlabel('Epoch') plt.ylabel(name) if metric == 'loss': plt.ylim([0, plt.ylim()[1]]) elif metric == 'auc': plt.ylim([0.8,1]) else: plt.ylim([0,1]) plt.legend() import matplotlib.pyplot as plt colors = plt.rcParams['axes.prop_cycle'].by_key()['color'] import matplotlib as mpl mpl.rcParams['figure.figsize'] = (20, 12) plot_metrics(final_model)#where abcde is fit call 