Skip to content

Commit 40499a1

Browse files
Copilotmensch72
andcommitted
Fix NaN acquisition scores by adding nan_to_num handling
Co-authored-by: mensch72 <22815964+mensch72@users.noreply.github.com>
1 parent 72fd1a6 commit 40499a1

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

aspai_active/acquisition.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,9 @@ def bald_acquisition(predictions):
4040
# BALD score = mutual information
4141
bald_scores = predictive_entropy - expected_entropy
4242

43+
# Handle any remaining NaN or inf values by replacing with 0
44+
bald_scores = torch.nan_to_num(bald_scores, nan=0.0, posinf=0.0, neginf=0.0)
45+
4346
return bald_scores
4447

4548

0 commit comments

Comments
 (0)