How to output valid data metrics with CSVLogger

I’m trying to use CSVLogger to log metrics during training. Although I see loss of both train and valid, I see only the metrics (e.g. accuracy) of train in the saved log file at each epoch:

Capture

Howe can I extract the metrics of valid data at each epoch as well?

1 Like

The accuracy score you see there is on the validation set.

Thanks. Then how can I get the metrics for train data?

It’s not recommended since the metrics on the validation set are more important (you want to see your validation metrics improve, training metrics improving doesn’t tell you if you’re model is overfitting).

If you really want it, you can do learn.validate(ds_idx=0)

1 Like

Thanks. It’s beneficial to have both train and valid data together to see their difference and check for example overfitting.

As I understand, learn.validate(ds_idx=0) only give the metrics of the final model (last epoch). Any way I can record the metrics of both train and valid at each epoch during training process?