feat: Add JointEmbeddingSCVI model#3883
Merged
Merged
Conversation
Add JointEmbeddingSCVI, a self-supervised SCVI variant that augments the standard ELBO with a cross-correlation objective (CCO) between the embedding of the data and a binomially-thinned view of it, encouraging embeddings that are robust to count dropout/noise. A VICReg-style variance term guards against dimension collapse. The joint-embedding loss is active only during training; evaluation (get_elbo / get_marginal_ll / get_reconstruction_error) falls back to the standard reweighted ELBO, and so does any minibatch with fewer than two cells. Contents: - src/scvi/module/_joint_embedding_utils.py: binomial thinning, per-cell thinning-probability sampling, cross-correlation and variance losses - src/scvi/module/_joint_embedding_vae.py: JointEmbeddingVAE module - src/scvi/model/_joint_embedding_scvi.py: JointEmbeddingSCVI model - tests/model/test_joint_embedding_scvi.py, tests/module/test_joint_embedding_utils.py - docs/api (user + developer) and CHANGELOG entries Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
97e92cf to
c389d15
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #3883 +/- ##
==========================================
+ Coverage 88.46% 88.50% +0.04%
==========================================
Files 227 231 +4
Lines 22955 23050 +95
==========================================
+ Hits 20306 20401 +95
Misses 2649 2649
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
Collaborator
|
close #3734 |
Collaborator
|
Hey @vals, Thank you so much for this! I want to make several changes and have made my own copy of this branch here: https://github.com/scverse/scvi-tools/tree/Ori_joint-embedding-scvi (I can't push to your repo), main changes:
Feel free to merge that branch into this one (of course, the tutorial will also need to adapt), or continue there. |
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Hi!
I curated the code from "Improving SCVI for low-count cells through self-supervised augmentation" into a pull request to add the new model class in scvi-tools.
I am working on a tutorial (that is a bit more visual and intuitive than the metrics I used in the paper). I'll PR that to the tutorials repo in a bit.
The summary below was generated by GitHub, and summarizes it nicely: