Is example given at -> Logloss for Binomial Classfication wrong?

My question is very fundamental clarification of maths regarding Log function. I do not understand why the example given on Wiki Fastai LogLoss page under Binary Classification has a Log function with negative domain (which afaik Log function would never take a negative number).

In the general formula given for binary classification the two probabilities are -> log( p ), log(1-p).
Yet in the example for mutli-class classification it is given value of log(0 - 0.25). Am I missing something?

  1. Why function that takes value of form log( p ), log(1-p) is given log(0 - 0.25) = log(-0.25)?

  2. Is a Log function with negative domain possible?

The form of the binary log loss (where truth is 0 or 1) is:

-l(pred | truth) = truth * log(pred) + (1 - truth) * log(1 - pred)

So if the prediction is 0.25 and the truth is 0, the worked example is:

-l(0.25 | 0) = 1 * (0 * log(0.25) + (1-0)*log(1-0.25))
-l(0.25 | 0) = log(0.75)
l(0.25 | 0) = -log(0.75)
l(0.25 | 0) = 0.1249

The error in the wiki comes from the fact that they used log(0-pred) instead of log(1-pred) in the last term.

The short answer is that the wiki is incorrect, and a log of a negative number is probably not what you want (it could yield an imaginary number, I suppose).