Skip to content

Commit

Permalink
Error in scanvi_ref multiclass accuracy calculation (#2938)
Browse files Browse the repository at this point in the history
added -1 to the squeeze in order to deal with the case of dim==1 in a
multiclass batch where there is 1 sample for the usage of scvi-> scanvi
transfer learning

close #2934

---------

Co-authored-by: Can Ergen <[email protected]>
  • Loading branch information
ori-kron-wis and canergen authored Aug 19, 2024
1 parent 659e387 commit 89d772a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ to [Semantic Versioning]. Full commit history is available in the

#### Fixed

- Fix logging of accuracy for cases with 1 sample per class in scANVI {pr}`2938`.
- Disable adversarial classifier if training with a single batch.
Previously this raised a None error {pr}`2914`.
- {meth}`~scvi.model.SCVI.get_normalized_expression` fixed for Poisson distribution and
Expand Down
2 changes: 1 addition & 1 deletion src/scvi/train/_trainingplans.py
Original file line number Diff line number Diff line change
Expand Up @@ -741,7 +741,7 @@ def compute_and_log_metrics(
return

classification_loss = loss_output.classification_loss
true_labels = loss_output.true_labels.squeeze()
true_labels = loss_output.true_labels.squeeze(-1)
logits = loss_output.logits
predicted_labels = torch.argmax(logits, dim=-1)

Expand Down

0 comments on commit 89d772a

Please sign in to comment.