def mcc(tp, tn, fp, fn):
    """ Matthew's Correlation Coefficient [-1, 1]
    
    0 = you're just guessing
    
    :param int tp: number of true positives
    :param int tn: number of true negatives
    :param int fp: number of false positives
    :param int fn: number of false negatives
    :rtype: float 
    """
    if tp + fp == 0 or tp + fn == 0 or tn + fp == 0 or tn + fn == 0:
        den = 1.0
    else:
        den = math.sqrt((tp + fp) * (tp + fn) * (tn + fp) * (tn + fn))
    return (tp * tn - fp * fn) / den