run/logreg_analysis.py
def report_results(data, labels, return_threshold=False, threshold=-1.0):
    """Reports the classification results to the logger

    Parameters
    ----------
    data : array_like
        The features for each sample in the data
    labels : list, array_like
        The binary class labels for each sample in the data
    return_threshold : bool
        If True, will also return the threshold used to compute the
        classification results
    threshold : float
        If -1.0, will find the best threshold and use that to find
        classification results. Otherwise, will use its value to find
        classification results.

    Returns
    -------
    threshold : float
        The threshold - only returned if return_threshold
    acc : float
        The accuracy of the classification predictions
    roc_score : float
        The ROC AUC score of the classification predictions
    sens : float
        The sensitivity of the classification predictions
    spec : float
        The specificity of the classification predictions
    """

    # Get the predicted scores for each sample
    pred_probs = logreg.predict_proba(data)

    # Find the threshold, acc/sens/spec for these predictions
    threshold, acc, sens, spec = get_best_acc(labels, pred_probs,
                                              fixed_threshold=threshold)

    # Compute the ROC AUC score for the predictions
    roc_score = roc_auc_score(labels, pred_probs)

    # Report to the logger
    logger.info('\t\tAcc:\t%.3f' % acc)
    logger.info('\t\tROC:\t%.3f' % roc_score)
    logger.info('\t\tSens:\t%.3f' % sens)
    logger.info('\t\tSpec:\t%.3f' % spec)

    if return_threshold:  # If returning the threshold, then do that
        return threshold, acc, roc_score, sens, spec

    else:  # If not returning the threshold, then return metrics only
        return acc, roc_score, sens, spec
Reports the classification results to the logger

    Parameters
    ----------
    data : array_like
        The features for each sample in the data
    labels : list, array_like
        The binary class labels for each sample in the data
    return_threshold : bool
        If True, will also return the threshold used to compute the
        classification results
    threshold : float
        If -1.0, will find the best threshold and use that to find
        classification results. Otherwise, will use its value to find
        classification results.

    Returns
    -------
    threshold : float
        The threshold - only returned if return_threshold
    acc : float
        The accuracy of the classification predictions
    roc_score : float
        The ROC AUC score of the classification predictions
    sens : float
        The sensitivity of the classification predictions
    spec : float
        The specificity of the classification predictions
    
Reports the classification results to the logger
Reports the classification results to the logger
def report_results(data, labels, return_threshold=False, threshold=-1.0):
    pred_probs = logreg.predict_proba(data)
    threshold, acc, sens, spec = get_best_acc(labels, pred_probs,
                                              fixed_threshold=threshold)
    roc_score = roc_auc_score(labels, pred_probs)
    logger.info('\t\tAcc:\t%.3f' % acc)
    logger.info('\t\tROC:\t%.3f' % roc_score)
    logger.info('\t\tSens:\t%.3f' % sens)
    logger.info('\t\tSpec:\t%.3f' % spec)
    if return_threshold:  
        return threshold, acc, roc_score, sens, spec
    else:  
        return acc, roc_score, sens, spec
def report_results ( data , labels , return_threshold = False , threshold = - 1.0 ) : pred_probs = logreg . predict_proba ( data ) threshold , acc , sens , spec = get_best_acc ( labels , pred_probs , fixed_threshold = threshold ) roc_score = roc_auc_score ( labels , pred_probs ) logger . info ( '\t\tAcc:\t%.3f' % acc ) logger . info ( '\t\tROC:\t%.3f' % roc_score ) logger . info ( '\t\tSens:\t%.3f' % sens ) logger . info ( '\t\tSpec:\t%.3f' % spec ) if return_threshold : return threshold , acc , roc_score , sens , spec else : return acc , roc_score , sens , spec
Reports the classification results to the logger
Reports the classification results to the logger
"""Reports the classification results to the logger

    Parameters
    ----------
    data : array_like
        The features for each sample in the data
    labels : list, array_like
        The binary class labels for each sample in the data
    return_threshold : bool
        If True, will also return the threshold used to compute the
        classification results
    threshold : float
        If -1.0, will find the best threshold and use that to find
        classification results. Otherwise, will use its value to find
        classification results.

    Returns
    -------
    threshold : float
        The threshold - only returned if return_threshold
    acc : float
        The accuracy of the classification predictions
    roc_score : float
        The ROC AUC score of the classification predictions
    sens : float
        The sensitivity of the classification predictions
    spec : float
        The specificity of the classification predictions
    """ # Get the predicted scores for each sample
 # Find the threshold, acc/sens/spec for these predictions
 # Compute the ROC AUC score for the predictions
 # Report to the logger
 # If returning the threshold, then do that
 # If not returning the threshold, then return metrics only

The threshold - only returned if return_threshold
The threshold - only returned if return_threshold
float

The accuracy of the classification predictions
The accuracy of the classification predictions
float

The ROC AUC score of the classification predictions
The ROC AUC score of the classification predictions
float

The sensitivity of the classification predictions
The sensitivity of the classification predictions
float

The specificity of the classification predictions
The specificity of the classification predictions
float

data
The features for each sample in the data
The features for each sample in the data
labels
The binary class labels for each sample in the data
The binary class labels for each sample in the data
return_threshold
If True, will also return the threshold used to compute the
classification results
If True will also return the threshold used to compute the classification results
threshold
1.0, will find the best threshold and use that to find
classification results. Otherwise, will use its value to find
classification results.
1 . 0 will find the best threshold and use that to find classification results . Otherwise will use its value to find classification results .