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): ...@@ -113,26 +113,25 @@ def TN_scorer(clf, X, y):
"""Gives the number of samples predicted as true negatives""" """Gives the number of samples predicted as true negatives"""
y_pred = clf.predict(X) y_pred = clf.predict(X)
cm = confusion_matrix(y, y_pred) cm = confusion_matrix(y, y_pred)
TN = cm[0,0] return cm[0, 0]
return TN
def FN_scorer(clf, X, y): def FN_scorer(clf, X, y):
"""Gives the number of samples predicted as false negatives""" """Gives the number of samples predicted as false negatives"""
y_pred = clf.predict(X) y_pred = clf.predict(X)
cm = confusion_matrix(y, y_pred) cm = confusion_matrix(y, y_pred)
FN = cm[0,1] return cm[1, 0]
return FN
def FP_scorer(clf, X, y): 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) y_pred = clf.predict(X)
cm = confusion_matrix(y, y_pred) cm = confusion_matrix(y, y_pred)
FP = cm[1,0] return cm[0, 1]
return FP
def TP_scorer(clf, X, y): 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) y_pred = clf.predict(X)
cm = confusion_matrix(y, y_pred) cm = confusion_matrix(y, y_pred)
TP = cm[1,1] return cm[1, 1]
return TP
def negative_recall_scorer(clf, X, y): def negative_recall_scorer(clf, X, y):
"""Gives the negative recall defined as the (number of true_negative_samples)/(total number of negative samples)""" """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): ...@@ -124,26 +124,25 @@ def TN_scorer(clf, X, y):
"""Gives the number of samples predicted as true negatives""" """Gives the number of samples predicted as true negatives"""
y_pred = clf.predict(X) y_pred = clf.predict(X)
cm = confusion_matrix(y, y_pred) cm = confusion_matrix(y, y_pred)
TN = cm[0,0] return cm[0, 0]
return TN
def FN_scorer(clf, X, y): def FN_scorer(clf, X, y):
"""Gives the number of samples predicted as false negatives""" """Gives the number of samples predicted as false negatives"""
y_pred = clf.predict(X) y_pred = clf.predict(X)
cm = confusion_matrix(y, y_pred) cm = confusion_matrix(y, y_pred)
FN = cm[0,1] return cm[1, 0]
return FN
def FP_scorer(clf, X, y): 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) y_pred = clf.predict(X)
cm = confusion_matrix(y, y_pred) cm = confusion_matrix(y, y_pred)
FP = cm[1,0] return cm[0, 1]
return FP
def TP_scorer(clf, X, y): 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) y_pred = clf.predict(X)
cm = confusion_matrix(y, y_pred) cm = confusion_matrix(y, y_pred)
TP = cm[1,1] return cm[1, 1]
return TP
def negative_recall_scorer(clf, X, y): def negative_recall_scorer(clf, X, y):
"""Gives the negative recall defined as the (number of true_negative_samples)/(total number of negative samples)""" """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