Skip to content

Commit

Permalink
fixed out of bounds for auroc computation on betti numbers
Browse files Browse the repository at this point in the history
  • Loading branch information
danielbinschmid committed Aug 16, 2024
1 parent c8f76b5 commit 65cd162
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions code/metrics/custom_metrics/auroc.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ def __init__(self, num_classes: int, **kwargs):
)

def update(self, preds: Tensor, target: Tensor) -> None:
preds = torch.min(
torch.max(preds, torch.tensor(0.0)),
torch.tensor(self.num_classes - 1),
).long()
y_hat = torch.nn.functional.one_hot(preds, self.num_classes).float()
self.auroc.update(preds=y_hat, target=target)

Expand Down

0 comments on commit 65cd162

Please sign in to comment.