Example #1
0
def get_classification_result(true_labels, pred_labels):
    """Return classification resuls for one fold.

    Return an array containing accuracy, precision, recall, and f1, based on the
    given true and predicted labels.

    Keyword arguments:
    fold_no -- this fold's number
    true_labels -- true labels
    pred_labels -- predicted labels
    """
    res = np.zeros((1, 4))
    res[:] = calc_metrics(true_labels, pred_labels)
    return res
Example #2
0
def get_classification_result(true_labels, pred_labels):
    """Return classification resuls for one fold.

    Return an array containing accuracy, precision, recall, and f1, based on the
    given true and predicted labels.

    Keyword arguments:
    fold_no -- this fold's number
    true_labels -- true labels
    pred_labels -- predicted labels
    """
    res = np.zeros((1, 4))
    res[:] = calc_metrics(true_labels, pred_labels)
    return res
Example #3
0
def get_classification_result(fold_no, true_labels, pred_labels):
    """Return classification resuls for one fold.

    Return an array containing accuracy, precision, recall, and f1, based on the
    given true and predicted labels.

    Parameters
    ----------
    fold_no : int
        this fold's number
    true_labels list(int)
        true labels
    pred_labels list(int)
        predicted labels

    Returns
    -------
    ndarray
        [fold number, accuracy, precision, recall, f1]
    """
    res = calc_metrics(true_labels, pred_labels)
    return np.asarray([fold_no] + [r for r in res])