Skip to content

Commit

Permalink
dont calc recall
Browse files Browse the repository at this point in the history
  • Loading branch information
AlyaGomaa committed Apr 18, 2024
1 parent ae6ccf2 commit b7d03fd
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
8 changes: 3 additions & 5 deletions metrics/calculator.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ def F1(self):
"""

precision = self.metrics['precision']
recall = self.metrics['recall']
recall = self.TPR(log=False)
if precision + recall == 0:
f1 = 0
else:
Expand Down Expand Up @@ -207,6 +207,7 @@ def TPR(self, log=True):
tpr = 0
else:
tpr = self.metrics['TP'] / (self.metrics['TP'] + self.metrics['FN'])

if log:
self.log(f"{self.tool}: TPR: ", tpr)
return tpr
Expand Down Expand Up @@ -265,14 +266,11 @@ def calc_all_metrics(self) -> Dict[str, float]:
self.FNR,
self.TPR,
self.TNR,
self.recall,
self.precision,
self.F1,
self.accuracy,
self.MCC,
):
res.update({metric.__name__ : metric()})
return res
# def __del__(self):
# if hasattr(self, 'db'):
# self.db.close()

3 changes: 1 addition & 2 deletions scripts/slips_metrics_getter.py
Original file line number Diff line number Diff line change
Expand Up @@ -232,14 +232,13 @@ def main():
# calc.calc_all_metrics()
experiment_metrics = {
'MCC': calc.MCC(),
'recall': calc.recall(),
'precision': calc.precision(),
'F1': calc.F1(),
'FPR': calc.FPR(),
'TPR': calc.TPR(),
'FNR': calc.FNR(),
'TNR': calc.TNR(),
'accuracy': calc.accuracy(),
'F1': calc.F1(),
}
experiment_metrics.update(confusion_matrix)
metrics[threshold].update({exp: experiment_metrics})
Expand Down

0 comments on commit b7d03fd

Please sign in to comment.