EvalResult: avg or iteration?

I know that the default for logging in EvalResult is “per epoch” but does that mean that it logs the iteration of the metric at the end of the epoch, or does it take an average of the metric over the epoch? thanks

https://pytorch-lightning.readthedocs.io/en/latest/api/pytorch_lightning.core.lightning.html#pytorch_lightning.core.lightning.LightningModule.log

check the reduce_fx here. By default, it takes the weighted average using the batch_size in each step. For eg

step1 - 5 (metric value) - 4 (batch_size)
step2 - 5 (metric value) - 3 (batch_size)

logged_value on epoch = (5*4 + 5*3) / (4+3)

you can add your own reduct_fx.

1 Like