2016-08-05 37 views
0
true = [1,0,0,1] 
predict = [1,1,1,1] 

cf = sk.metrics.confusion_matrix(true,predict) 
print cf 

ArrayEmpfindlichkeit von Scikit_Learn Konfusionsmatrix abgeleitet und Scikit_Learn Recall_Score entspricht nicht

([[0, 2],

[0, 2]])

tp = cf[0][0] 
fn = cf[0][1] 
fp = cf[1][0] 
tn = cf[1][1] 
sensitivity= tp/(tp+fn) 
print(sensitivity) 

0.0

print(sk.metrics.recall_score(true, predict)) 

1,0

Laut Scikit-Dokumentation "Recall_Score" muss die Definition übereinstimmen. Kann jemand etwas mehr dazu erklären?

Antwort

1

Confusion Matrix Etiketten müssen in folgenden Weise aktualisiert werden:

tn = cf[0][0] 
fp = cf[0][1] 
fn = cf[1][0] 
tp = cf[1][1] 
sensitivity= tp/(tp+fn) 
print(sensitivity) 

1.0