Metric values using `get_preds` don't match `fit_one_cycle` values

Hi,

I’ve redone the lesson2-planet notebook and while the model trains really nicely, I don’t understand the reported metrics obtained on the validation set using learn.get_preds. They are too low and don’t match the validation metric performance from the last epoch of training. Note that the predictions are computed correctly since the results I get when submitting to Kaggle are quite good.

image

The entire notebook is [https://github.com/ddrevicky/fastai-v3-notebooks/blob/master/my_planet.ipynb] (here).

preds is passed through sigmoid within get_preds but metrics you are using need raw outputs without any activation. You can do:

preds_raw = torch.log(preds/(1-preds)) # inverse_of_sigmoid
learn.metrics[0](preds_raw, targs), learn.metrics[1](preds_raw, targs)
3 Likes

Thanks Rohit, that worked :slight_smile:.