# Deviance when y = 0

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 ?

Thanks

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 ?

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