def get_stats(tp, tn, fp, fn):
    """
    Computes performace measures using the correctness measures returned by
    check_preds()

    Parameters:
    -----------------
    tp: number of true  positive predictions returned by check_preds()
    fp: number of false positive predictions returned by check_preds()
    tn: number of true  negative predictions returned by check_preds()
    fn: number of false negative predictions returned by check_preds()

    Returns:
    -----------------
    acc:       (tp + tn) / (tp + tn + fp + fn)
    recall:    tp / (tp + fn)
    precision: tp / (tp + fp)
    fscore:    F1 Score, 2 * precision * recall / (precision + recall)
    """
    acc = (tp + tn) / (tp + tn + fp + fn)
    recall = 0.0
    precision = 0.0
    fscore = 0.0

    if tp == 0.0:
        if fp == 0.0 and fn == 0.0:
            recall, precision, fscore = 1.0, 1.0, 1.0
        else:
            recall, precision, fscore = 0.0, 0.0, 0.0
    else:
        recall = tp / (tp + fn)
        precision = tp / (tp + fp)
        fscore = 2 * precision * recall / (precision + recall)

    return (acc, recall, precision, fscore)