def categorical_error(p, t):
    """
    Calculate error rate

    Args:
        p: logit (float values of log(p(y|x)))
        t: label (int)

    Returns:
        error rate
    """
    k = p.argmax(1)
    return (k != t.flat).mean()