I am trying to compute deviance for the predictions of my dataset and I encounter quite a big problem here.

Deviance is calculated as : $2 (\log(\mathrm{yTrue}) - \log(\mathrm{yPred}))$ where $\log$ is the Naperian logarithm.

The problem is that most of my target values are equal to $0,$ meaning that yTrue will often be $0$ resulting in $-\infty$ as a result.

I was wondering what was the best solution to this problem ? I tried adding $e = 0.00000001$ to the target values but it makes no sense because my deviance will then always be around -20.

What is the best way to solve this ?


Edit : Thinking about using $e^\mathrm{yTrue}$ and $e^\mathrm{yPred}$ instead of $\mathrm{yTrue}$ and $\mathrm{yPred}$, do you think this is a good idea ?

  • $\begingroup$ Can you please provide more details about $y$? Is it a continuous variable (in which range?) or dichotomous or something else? $\endgroup$ – Ertxiem Apr 19 at 15:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.