def Brier(probs, true):
    """
    Brier score (mean squared error)
    
    Args:
        probs (list): 2-D list of probabilities
        true (list): 1-D list of true labels
        
    Returns:
        brier: brier score
    """

    assert len(probs) == len(true)

    n = len(true)  # number of samples
    k = len(probs[0])  # number of classes

    brier = 0

    for i in range(n):  # Go through all the samples
        for j in range(k):  # Go through all the classes
            y = 1 if j == true[i] else 0  # Check if correct class
            brier += (probs[i][j] - y) ** 2  # squared error

    return brier / n / k