ptrblck:

l_n = -w_n * [ p_n * log(sigmoid(x_n) + (1-t_n) * log(1 - sigmoid(x_n))]


the formula you wrote is missing the part t_n multiplied by p_n. this way the formula will be in the negative class :



 ptrblck:

l_n = -w_n * [ p_n * 0 * log(sigmoid(x_n) + (1) * log(1 - sigmoid(x_n))]


so the p_n has no contribution to the negative class as I can see and so why do we have to give p_n with the number of classes ?