Commit e6fc4387 authored by Joaquin Torres's avatar Joaquin Torres

FP and FN were switched

parent 5359c86d
......@@ -113,26 +113,25 @@ def TN_scorer(clf, X, y):
"""Gives the number of samples predicted as true negatives"""
y_pred = clf.predict(X)
cm = confusion_matrix(y, y_pred)
TN = cm[0,0]
return TN
return cm[0, 0]
def FN_scorer(clf, X, y):
"""Gives the number of samples predicted as false negatives"""
y_pred = clf.predict(X)
cm = confusion_matrix(y, y_pred)
FN = cm[0,1]
return FN
return cm[1, 0]
def FP_scorer(clf, X, y):
"""Gives the number of samples predicted as false positive"""
"""Gives the number of samples predicted as false positives"""
y_pred = clf.predict(X)
cm = confusion_matrix(y, y_pred)
FP = cm[1,0]
return FP
return cm[0, 1]
def TP_scorer(clf, X, y):
"""Gives the number of samples predicted as true positive"""
"""Gives the number of samples predicted as true positives"""
y_pred = clf.predict(X)
cm = confusion_matrix(y, y_pred)
TP = cm[1,1]
return TP
return cm[1, 1]
def negative_recall_scorer(clf, X, y):
"""Gives the negative recall defined as the (number of true_negative_samples)/(total number of negative samples)"""
......
......@@ -124,26 +124,25 @@ def TN_scorer(clf, X, y):
"""Gives the number of samples predicted as true negatives"""
y_pred = clf.predict(X)
cm = confusion_matrix(y, y_pred)
TN = cm[0,0]
return TN
return cm[0, 0]
def FN_scorer(clf, X, y):
"""Gives the number of samples predicted as false negatives"""
y_pred = clf.predict(X)
cm = confusion_matrix(y, y_pred)
FN = cm[0,1]
return FN
return cm[1, 0]
def FP_scorer(clf, X, y):
"""Gives the number of samples predicted as false positive"""
"""Gives the number of samples predicted as false positives"""
y_pred = clf.predict(X)
cm = confusion_matrix(y, y_pred)
FP = cm[1,0]
return FP
return cm[0, 1]
def TP_scorer(clf, X, y):
"""Gives the number of samples predicted as true positive"""
"""Gives the number of samples predicted as true positives"""
y_pred = clf.predict(X)
cm = confusion_matrix(y, y_pred)
TP = cm[1,1]
return TP
return cm[1, 1]
def negative_recall_scorer(clf, X, y):
"""Gives the negative recall defined as the (number of true_negative_samples)/(total number of negative samples)"""
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment