Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Jan 9, 2025
1 parent 43d3013 commit 2e8a5eb
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions monai/metrics/confusion_matrix_patch.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ def compute_confusion_matrix_metric(metric_name: str, confusion_matrix: torch.Te
# calculate metric
numerator: torch.Tensor
denominator: torch.Tensor | float
nan_tensor = torch.tensor(float("nan"), device=confusion_matrix.device)
nan_tensor = torch.tensor(float("nan"), device=confusion_matrix.device)

"""
1. tpr - True Positive Rate (Recall): The ratio of correctly predicted positive samples to the total number of samples that are actually positive.
Expand All @@ -246,7 +246,7 @@ def compute_confusion_matrix_metric(metric_name: str, confusion_matrix: torch.Te
match metric:
case "tpr":
numerator, denominator = tp, p
case "tnr": #
case "tnr": #
numerator, denominator = tn, n
case "ppv":
numerator, denominator = tp, (tp + fp)
Expand Down Expand Up @@ -357,4 +357,4 @@ def check_confusion_matrix_metric_name(metric_name: str) -> str:
y_test = [0 ,1, 1, 1, 0, 1, 0, 1, 0, 1, 1]
y_pred = [0, 1, 1, 0, 1, 0, 1, 1, 1, 0, 1]

print(confusion_matrix(y_test, y_pred))
print(confusion_matrix(y_test, y_pred))

0 comments on commit 2e8a5eb

Please sign in to comment.