0

After training a model, I want to plot the accuracy, validation accuracy, etc. In Seaborn, this is what I tried to do:

df_model_history = pd.DataFrame(
    np.array([
        history.history['accuracy'],
        history.history['val_accuracy']
    ]).T,
    columns=['Accuracy', 'Validation Accuracy']
)

df_model_history.index.name = 'Epochs'

That creates a data frame that looks like this:

Epochs Accuracy Validation Accuracy
0 0.769296 0.766673
1 0.858553 0.894064
2 0.915641 0.901508
3 0.936782 0.892285

And when I want to plot, I do this:

sns.set(rc={'figure.figsize':(11.7,8.27)})

sns.lineplot(
    x='Epochs',
    y='Accuracy',
    data=df_model_history
)

However, this only plots a single variable in the figure, but I wanted both 'accuracy' and 'val_accuracy' in the same figure. Also, compared to Matplotlib, I have a lot more steps in Seaborn to plot the same output, so I was wondering if I'm doing it incorrectly.

Trenton McKinney
  • 56,955
  • 33
  • 144
  • 158
krisjuna
  • 5
  • 2

0 Answers0