INNER CODE UNIT · Python

plot_roc_auc

alteryx/open_source_demos · predict-appointment-noshow/utils.py:53

def plot_roc_auc(y_test, probs, pos_label=1):
    fpr, tpr, thresholds = roc_curve(y_test,
                                     probs[:, 1],
                                     pos_label=pos_label)

    output_notebook()
    p = figure(height=400, width=400)
    p.line(x=fpr, y=tpr)
    p.title.text = 'Receiver operating characteristic'
    p.xaxis.axis_label = 'False Positive Rate'
    p.yaxis.axis_label = 'True Positive Rate'

    p.line(x=fpr, y=fpr, color='red', line_dash='dashed')
    return(p)


def plot_f1(y_test, probs, nprecs):
    threshes = [x/1000. for x in range(50, nprecs)]

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…