Skip to content

Commit fa3a7b8

Browse files
valsclaudeori-kron-wis
authored
feat: Add JointEmbeddingSCVI model (#3883)
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: > 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> Co-authored-by: ori-kron-wis <ori.kronfeld@weizmann.ac.il>
1 parent f34d577 commit fa3a7b8

15 files changed

Lines changed: 800 additions & 1 deletion

File tree

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ to [Semantic Versioning]. The full commit history is available in the [commit lo
1414
enabling memory-efficient training on large-scale datasets stored as sharded Zarr collections,
1515
with support for batch covariates, {pr}`3620`.
1616
- Add support for rapids-singlecell, {pr}`3811`.
17+
- Add {class}`scvi.external.JointEmbeddingSCVI`, a self-supervised SCVI variant using binomial
18+
thinning and a cross-correlation objective (CCO) for robust embeddings, {pr}`3883`.
1719
- Add {class}`scvi.external.CYTOVI` KNN imputation backend option to be cuML, {pr}`3821`.
1820

1921
#### Fixed

docs/api/developer.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ Module classes in the external API with respective generative and inference proc
197197
external.scviva.NicheLossOutput
198198
external.sysvi.SysVAE
199199
external.diagvi.DIAGVAE
200-
200+
external.JointEmbeddingVAE
201201
```
202202

203203
## Module (Base)

docs/api/user.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ import scvi
6767
external.SysVI
6868
external.SCVIVA
6969
external.DIAGVI
70+
external.JointEmbeddingSCVI
7071
external.Tangram
7172
```
7273

docs/references.bib

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -386,3 +386,12 @@ @article{Weinberger26
386386
month = apr,
387387
publisher={Nature Publishing Group}
388388
}
389+
390+
@article{Svensson26,
391+
title={Improving SCVI for low-count cells through self-supervised augmentation},
392+
author={Valentine Svensson},
393+
journal={bioRxiv},
394+
year={2026},
395+
publisher={Cold Spring Harbor Laboratory},
396+
doi = {10.64898/2026.02.11.705441}
397+
}

docs/tutorials/index_scrna.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ notebooks/scrna/AutoZI_tutorial
1818
notebooks/scrna/sysVI
1919
notebooks/scrna/decipher_tutorial
2020
notebooks/scrna/velovi
21+
notebooks/scrna/JointEmbeddingSCVI_tutorial
2122
notebooks/scrna/Tahoe100_mrVI
2223
```
2324

@@ -126,6 +127,13 @@ Use Decipher to jointly analyze samples from distinct conditions.
126127
Use VeloVI to estimate RNA velocity.
127128
```
128129

130+
```{customcard}
131+
:path: notebooks/scrna/JointEmbeddingSCVI_tutorial
132+
:tags: Analysis
133+
134+
Use JointEmbeddingSCVI for improving SCVI for low-count cells through self-supervised augmentation
135+
```
136+
129137
```{customcard}
130138
:path: notebooks/scrna/Tahoe100_mrVI
131139
:tags: Analysis, Differential-comparison, Dimensionality-reduction, Removal-of-variance

docs/user_guide/index.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,9 @@ scvi-tools is composed of models that can perform one or many analysis tasks. In
5454
* - :doc:`/user_guide/models/velovi`
5555
- Deep generative modeling of transcriptional dynamics for RNA velocity analysis in single cells
5656
- :cite:p:`GayosoWeiler23`
57+
* - :doc:`/user_guide/models/jointembeddingscvi`
58+
- Improving SCVI for low-count cells through self-supervised augmentation
59+
- :cite:p:`Svensson26`
5760
```
5861

5962
## ATAC-seq analysis

docs/user_guide/models/index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ decipher
1212
destvi
1313
diagvi
1414
gimvi
15+
jointembeddingscvi
1516
linearscvi
1617
methylanvi
1718
methylvi
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Joint-Embedding SCVI
2+
3+
:::{note}
4+
This page is under construction.
5+
:::
6+
7+
**JointEmbeddingSCVI** {cite:p}`Svensson26` (Python class {class}`~scvi.external.JointEmbeddingSCVI`) is a ...
8+
9+
The advantages of JointEmbeddingSCVI are:
10+
11+
- ...
12+
13+
The limitations of JointEmbeddingSCVI include:
14+
15+
- ...
16+
17+
```{topic} Tutorials:
18+
19+
- {doc}`/tutorials/notebooks/scrna/JointEmbeddingSCVI_tutorial`
20+
```

src/scvi/external/__init__.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
from .decipher import Decipher
55
from .diagvi import DIAGVI
66
from .gimvi import GIMVI
7+
from .joint_embedding_scvi import JointEmbeddingSCVI, JointEmbeddingVAE
78
from .methylvi import METHYLANVI, METHYLVI
89
from .mrvi import MRVI
910
from .poissonvi import POISSONVI
@@ -22,6 +23,8 @@
2223
"SCAR",
2324
"SOLO",
2425
"GIMVI",
26+
"JointEmbeddingSCVI",
27+
"JointEmbeddingVAE",
2528
"Decipher",
2629
"RNAStereoscope",
2730
"SpatialStereoscope",
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
from ._model import JointEmbeddingSCVI
2+
from ._module import JointEmbeddingVAE
3+
4+
__all__ = ["JointEmbeddingSCVI", "JointEmbeddingVAE"]

0 commit comments

Comments
 (0)