text_plain_output_1.png
import numpy as np # linear algebra

def logloss_err(y, p):
    N = len(p)
    err = -1 / N * np.sum(y * np.log(p))
    return err

p = np.array([[0.2, 0.8], [0.7, 0.3]])
y = np.array([[0, 1], [1, 0]])
logloss_err(y, p)