hendrycks / ss-ood

Self-Supervised Learning for OOD Detection (NeurIPS 2019)
MIT License
264 stars 31 forks source link

Why negative KL for classification loss when doing OOD detection #19

Closed zjysteven closed 3 years ago

zjysteven commented 3 years ago

Hi,

Thanks for making the code public, which helps a lot. I'm just wondering why there is a -1 for the classification loss when doing OOD detection? https://github.com/hendrycks/ss-ood/blob/2a284be3f36de467ed3f35d8fa61bd9be7e261d6/multiclass_ood/test_auxiliary_ood.py#L182-L185

Thanks!

hendrycks commented 3 years ago

It's because OOD examples should have higher scores in-distribution examples. That's what the scikit-learn metrics are expecting. Multiplying by -1 does not affect the quality of the detector.

zjysteven commented 3 years ago

I see how I got it wrong. Thanks!