'Returns an (accuracy, precision, recall, F1-score)-tuple.'

def test(self, target=None):

    A = []
    P = []
    R = []
    for (type, TP, TN, FP, FN) in self.split():
        if ((type == target) or (target is None)):
            A.append((float((TP + TN)) / (((TP + TN) + FP) + FN)))
            P.append((float(TP) / ((TP + FP) or 1)))
            R.append((float(TP) / ((TP + FN) or 1)))
    A = (sum(A) / (len(A) or 1.0))
    P = (sum(P) / (len(P) or 1.0))
    R = (sum(R) / (len(R) or 1.0))
    F = (((2.0 * P) * R) / ((P + R) or 1.0))
    return (A, P, R, F)
