def categorical_error(pred, label):
    """
        Compute categorical error given score vectors and labels as
        numpy.ndarray.
    """
    pred_label = pred.argmax(1)
    return (pred_label != label.flat).mean()