TCGA Pan-Cancer Set-Transformer
A self-supervised, permutation-equivariant, uncertainty-aware classifier for large-scale, high-dimensional tabular data, evaluated on the UCSC Toil TCGA Pan-Cancer RNA-seq recompute (9185 primary-tumor samples, 48482 features, 32 categorical classes; 70/15/15 train, validation, test split, so 1378 held-out test samples).
This is a methods/representation-learning study. No biological, diagnostic, or clinical claims are made or implied. Class labels are used strictly as categorical ids for a tabular multi-class benchmark.
Architecture
- Feature tokenizer: shared value projection + learned per-feature
identity embedding (see
tokenizer.pyin the source repo). - Set-Transformer encoder (Lee et al., 2019) with Induced Set Attention Blocks for O(n*m) scalability across tens of thousands of feature tokens, and Pooling by Multihead Attention for the final representation.
- VICReg self-supervised pretraining (Bardes, Ponce & LeCun, 2022).
- Mean-field variational ("Bayes-by-Backprop") linear classification head for calibrated predictive uncertainty.
Files
model.pt-- backbone + Bayesian head state dicts (see source repo for the exact module definitions needed to load them).config.yaml-- architecture / training hyperparameters.model.onnx-- the same model exported to ONNX (mean posterior weights, deterministic pass), used by the in-browser demo.demo_samples.npz,classes.json-- small bundle used by the live dashboard (not the full training dataset).results/-- the raw metrics (per-epoch history, per-class numbers, confusion matrix, calibration bins) behind every row of the table below.
Results, reported honestly
The point of this benchmark is to check whether each piece of the architecture earns its place, not to assume it does. On this dataset and split, it mostly doesn't, on raw test accuracy:
| Model | Test accuracy | F1 (macro) | ECE |
|---|---|---|---|
| Logistic regression (baseline) | 96.1% | 94.4% | -- |
| Plain MLP (baseline) | 95.4% | 93.5% | -- |
| Random forest (baseline) | 94.2% | 89.9% | -- |
| Ablation: no equivariant encoder (MLP + Bayesian head) | 94.0% | 91.7% | 0.053 |
| Ablation: no SSL pretraining | 88.7% | 84.3% | 0.069 |
| Full model (SSL + equivariant encoder + Bayesian head) | 88.1% | 83.3% | 0.077 |
The simple baselines win here. This dataset is close to linearly separable in log-expression space, so the architectural machinery built for harder, less separable tabular problems doesn't pay for itself on raw accuracy on this one -- and that's a real finding, not a caveat to bury. Full history, per-class breakdowns, and the code for every row above are in the source repository.
Live demo
- In-browser demo (ONNX Runtime Web, no server to keep running): https://mahdisabetkish.github.io/tcga-cancer-type-classifier/
- Full interactive dashboard (Docker image, local run):
docker run -p 7860:7860 mahdisabetkish/tcga-pancancer-set-transformer
Source
Code: https://github.com/mahdisabetkish/tcga-cancer-type-classifier