def ret_class(beta, p, pthre=0.05):
    """
    tp = 0 : prediction 1, real 1
    fp = 1 : prediction 1 ,real 0
    fn = 2 : prediction 0 , real 1
    tn = 3 : prediction 0, real 0
    """
    pred = 1 if p < pthre else 0
    real = 1 if beta != 0 else 0
    if pred == 1 and real == 1:
        return 0
    elif pred == 1 and real == 0:
        return 1
    elif pred == 0 and real == 1:
        return 2
    else:
        return 3