Skip to content

Commit

Permalink
Making _handle_result private in sanity_checker
Browse files Browse the repository at this point in the history
  • Loading branch information
SebieF committed Dec 8, 2022
1 parent 1dd9fd7 commit 8d81094
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions biotrainer/utilities/sanity_checker.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ def __init__(self, output_vars: Dict, mode: str = "Warn"):
self.output_vars = output_vars
self.mode = mode

def handle_result(self, result: str):
def _handle_result(self, result: str):
if self.mode == "Warn":
logger.warning(result)
elif self.mode == "Error":
Expand All @@ -32,13 +32,13 @@ def check_test_results(self):
precision = test_result_metrics['precision']
recall = test_result_metrics['recall']
if accuracy == precision == recall:
self.handle_result(f"Accuracy ({accuracy} == Precision == Recall for binary prediction!")
self._handle_result(f"Accuracy ({accuracy} == Precision == Recall for binary prediction!")

if "predictions" in test_results:
predictions = test_results['predictions']
# Check if the model is only predicting the same value for all test samples:
if all(prediction == predictions[0] for prediction in predictions):
self.handle_result(f"Model is only predicting {predictions[0]} for all test samples!")
self._handle_result(f"Model is only predicting {predictions[0]} for all test samples!")

logger.info("Sanity check on test results successful!")

Expand Down

0 comments on commit 8d81094

Please sign in to comment.