コード例 #1
0
def circuitSNP_metrics(predictions, labels, model_name):
    # y_pred = model.predict(x, verbose=0)
    y_pred = predictions
    y = labels
    mets = CH.get_metrics(y, y_pred)
    prec, rec, _ = precision_recall_curve(y, y_pred)
    auPRC = average_precision_score(y, y_pred)
    fpr, tpr, _ = roc_curve(y, y_pred)
    auROC = auc(fpr, tpr)
    prec_at_10_rec = prec[np.abs(rec - 0.1).argmin()]
    auprc = '{:0.4f}'.format(auPRC)
    auroc = '{:0.4f}'.format(auROC)
    prec_10 = '{:0.4f}'.format(prec_at_10_rec)
    rec_50 = '{:0.4f}'.format(mets['rec50'])
    return ({
        'prec': prec,
        'rec': rec,
        'auprc': auprc,
        'fpr': fpr,
        'tpr': tpr,
        'auroc': auroc,
        'y_pred': y_pred,
        'prec_10': prec_10,
        'model_name': model_name,
        'rec_50': rec_50
    })
コード例 #2
0
def get_prc_roc_validation_pwm_model(model, data1, data2, data3,
                                     good_pwms_idx):
    # from CNN_Models import cnn_helpers2 as CH
    x = [
        data1['test_data_X'][:, good_pwms_idx],
        data2['test_data_X'][:, good_pwms_idx], data3['test_data_X']
    ]
    y = data1['test_data_Y']
    y_pred = model.predict(x, verbose=0)
    mets = CH.get_metrics(y, y_pred)
    prec, rec, _ = precision_recall_curve(y, y_pred)
    auPRC = average_precision_score(y, y_pred)
    fpr, tpr, _ = roc_curve(y, y_pred)
    auROC = auc(fpr, tpr)
    auprc = '{:0.4f}'.format(auPRC)
    auroc = '{:0.4f}'.format(auROC)
    return ({
        'prec': prec,
        'rec': rec,
        'auprc': auprc,
        'fpr': fpr,
        'tpr': tpr,
        'auroc': auroc,
        'y_pred': y_pred
    })
コード例 #3
0
def get_prc_roc_test_joint_model(model, x1, x2, x3, y):
    y_pred = model.predict([x1, x2, x3], verbose=0)
    mets = CH.get_metrics(y, y_pred)
    prec, rec, _ = precision_recall_curve(y, y_pred)
    auPRC = average_precision_score(y, y_pred)
    fpr, tpr, _ = roc_curve(y, y_pred)
    auROC = auc(fpr, tpr)
    auprc = '{:0.4f}'.format(auPRC)
    auroc = '{:0.4f}'.format(auROC)
    return ({
        'prec': prec,
        'rec': rec,
        'auprc': auprc,
        'fpr': fpr,
        'tpr': tpr,
        'auroc': auroc,
        'y_pred': y_pred
    })
コード例 #4
0
def get_prc_roc_validation(model, data):
    x = data['test_data_X']
    y = data['test_data_Y']
    y_pred = model.predict(x, verbose=0)
    mets = CH.get_metrics(y, y_pred)
    prec, rec, _ = precision_recall_curve(y, y_pred)
    auPRC = average_precision_score(y, y_pred)
    fpr, tpr, _ = roc_curve(y, y_pred)
    auROC = auc(fpr, tpr)
    prec_at_10_rec = prec[np.abs(rec - 0.1).argmin()]
    auprc = '{:0.4f}'.format(auPRC)
    auroc = '{:0.4f}'.format(auROC)
    prec_10 = '{:0.4f}'.format(prec_at_10_rec)
    return ({
        'prec': prec,
        'rec': rec,
        'auprc': auprc,
        'fpr': fpr,
        'tpr': tpr,
        'auroc': auroc,
        'y_pred': y_pred,
        'prec_10': prec_10
    })
コード例 #5
0
def circuitSNP_test_new_model_metrics(test_data, test_y, model):
    x = test_data
    y_pred = model.predict(x, verbose=0)
    y = test_y
    mets = CH.get_metrics(y, y_pred)
    prec, rec, _ = precision_recall_curve(y, y_pred)
    auPRC = average_precision_score(y, y_pred)
    fpr, tpr, _ = roc_curve(y, y_pred)
    auROC = auc(fpr, tpr)
    prec_at_10_rec = prec[np.abs(rec - 0.1).argmin()]
    auprc = '{:0.4f}'.format(auPRC)
    auroc = '{:0.4f}'.format(auROC)
    prec_10 = '{:0.4f}'.format(prec_at_10_rec)
    return ({
        'prec': prec,
        'rec': rec,
        'auprc': auprc,
        'fpr': fpr,
        'tpr': tpr,
        'auroc': auroc,
        'y_pred': y_pred,
        'prec_10': prec_10
    })