Kang Prayit
Kang Prayit

Reputation: 19

Skorch: How to plot training and validation Accuracy

Is there a way how to plot a training and validation accuracy after we finished training with Skorch net.fit(X_train, y_train). We can see the train_loss, valid_loss, and valid_acc but how about train_acc? Thank you.

Upvotes: 1

Views: 785

Answers (1)

nemo
nemo

Reputation: 57729

This was also answered in the skorch issue tracker but in short you can simply add further scorer for the train accuracy:

net = NeuralNetClassifier(
    # ...
    callbacks=[
        EpochScoring(scoring='accuracy', name='train_acc', on_train=True),
    ],
)

If you are working in a jupyter notebook you can simply run

import matplotlib.pyplot as plt
plt.plot(net.history[:, 'train_acc'])

Upvotes: 2

Related Questions