socooper commited on
Commit
0834211
·
verified ·
1 Parent(s): 56778ee

Upload README.md with huggingface_hub

Browse files
Files changed (1) hide show
  1. README.md +71 -0
README.md ADDED
@@ -0,0 +1,71 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: cc-by-4.0
3
+ tags:
4
+ - single-cell
5
+ - scRNA-seq
6
+ - batch-correction
7
+ - scvi
8
+ library_name: pytorch
9
+ ---
10
+
11
+ # BA-scVI trained on scMARK v2
12
+
13
+ A Batch-Adversarial scVI model trained on the [scMARK v2](https://zenodo.org/records/7795653)
14
+ benchmark (11 cancer scRNA-seq studies, 109,543 cells, 23 standardised cell types).
15
+
16
+ ## Result
17
+
18
+ Scored with the K-Neighbors Intersection (KNI) metric from
19
+ [Diaz-Mejia et al., LMRL @ ICLR 2025](https://arxiv.org/abs/2503.20730)
20
+ (k=50, tau=0.8k, batch = `study_name`, label = `standard_true_celltype`),
21
+ over all 109,543 cells:
22
+
23
+ | model | KNI | cross-study acc | batch diversity |
24
+ |---|---|---|---|
25
+ | **this model** | **0.7153** | 0.7182 | 0.995 |
26
+ | BA-scVI (published) | 0.7110 | 0.712 | 0.999 |
27
+ | PCA baseline | 0.470 | - | - |
28
+
29
+ The published 0.7110 was independently reproduced from the authors' released
30
+ embedding using both their `calc_kni_score` and our implementation (0.7110 /
31
+ 0.7114), so the two numbers are directly comparable.
32
+
33
+ ## Architecture
34
+
35
+ scVI-family VAE with ZINB likelihood and an adversarial discriminator on the
36
+ latent. Batch identity is injected into the **decoder only** (the encoder never
37
+ sees it), matching the configuration used for the published BA-scVI results.
38
+
39
+ - 10-d latent, 512 hidden units, 4 layers, dropout 0.1
40
+ - ZINB reconstruction, masked by each study's measured gene panel
41
+ - discriminator weight 100, confusion objective, normalised per batch level
42
+ - batch levels: 1 modality / 11 studies / 354 samples
43
+ - input: 35,804 genes (see `gene_list.txt`; order matters)
44
+
45
+ ## Usage
46
+
47
+ ```python
48
+ import torch
49
+ ck = torch.load("bascvi_scmark_epoch63.ckpt", map_location="cpu", weights_only=False)
50
+ gene_list = ck["hyper_parameters"]["gene_list"] # 35,804 HGNC symbols, input order
51
+ ```
52
+
53
+ Counts must be raw integers in `gene_list` order; the model applies
54
+ `log(1 + 1e4 * x / x.sum())` internally. Embed via
55
+ `forward(batch, encode=True, predict_mode=True)["qz_m"]`, which zeroes the batch
56
+ vector — the latent is what you score.
57
+
58
+ ## Training data
59
+
60
+ Trained **only** on scMARK v2 (CC-BY 4.0). No other expression data was used.
61
+ The 35,804-gene input vocabulary is a superset reference gene list; genes a
62
+ study did not measure are masked out of the reconstruction loss as structural
63
+ zeros rather than treated as biological zeros.
64
+
65
+ ## Caveats
66
+
67
+ - KNI is computed over all cells, including those the model trained on — this is
68
+ the published benchmark's own methodology, and applies equally to the 0.7110
69
+ reference.
70
+ - KNI rewards low-dimensional embeddings through its batch-diversity gate; all
71
+ numbers above are at 10-d.