Exemple #1
0
def _calculate_auc(classifier, Xt, yt):
    w = classifier.coef_
    b = classifier.intercept_[0]
    lin = np.dot(Xt, w.T) + b
    prob = sigmoid(lin)
    fpr, tpr, thresholds = roc_curve(yt, prob, 
            thresholds=np.linspace(prob.min(),prob.max(),1e3))
    auc_score = auc(fpr, tpr)
    return auc_score, fpr, tpr
Exemple #2
0
def calculate_auc_score(nn, X, y):
    probabilities = np.array([nn.activate(row).tolist() for row in X])
    fpr, tpr, thresholds = roc_curve(y, probabilities, 
            thresholds=np.linspace(0,1,1e3))
    auc_score = auc(fpr, tpr)
    return auc_score, fpr, tpr