def f1_score(tp,fp,tn,fn):
    """ Computes F1-score, see http://en.wikipedia.org/wiki/F1_score

    :param tp: True positives  (TP)
    :param fp: False positives (FP)
    :param tn: True negatives  (TN)
    :param fn: False negatives (FN)
    :return: F1-score in [0,1]
    """
    return 2*tp/float(2*tp + fn + fp)