def performance_measure(confusion_matrix):
    """Return [accuracy, precision, recall, f1 score] based on given confusion matrix

    Args:
        confusion_matrix (2d array): given based on the following format:
            [[true positive, false negative],
             [false positive, true negative]]

    """
    tp = confusion_matrix[0][0]
    fn = confusion_matrix[0][1]
    fp = confusion_matrix[1][0]
    tn = confusion_matrix[1][1]
    accuracy = (tp+tn) / (tp+fn+fp+tn)
    precision = tp / (tp+fp)
    recall = tp / (tp+fn)
    f1 = 2*precision*recall / (precision + recall)
    return [accuracy, precision, recall, f1]