IRG CNN baselines (notebook 07)
Thirty small from-scratch CNN classifiers (3 biosamples x 2 architectures x 5 seeds) that predict whether a 1,000 bp window
is an ENCODE candidate cis-regulatory element (cCRE: PLS, pELS or dELS) of one biosample, against GC-matched genomic
background. Trained on PxALabs/encode-regulatory-elements v2.1, *_gc_matched tables. Part of
github.com/PxA-Labs/interpretable-regulatory-genomics. No pretrained or language models are involved.
Files
weights/<biosample>/<arch>/seed<N>.safetensors- state dicts (biosample:tcell,k562,gm12878; arch:shallow_cnn,attn_cnn; seeds 0-4)model_def.py- standalone architecture +predict(forward and reverse-complement strand averaged)manifest.json- per file: SHA-256, learning rate, epochs, parameters, validation and test AUROC;MANIFEST.sha256
Usage
from safetensors.torch import load_file
from model_def import build, predict
m = build("shallow_cnn"); m.load_state_dict(load_file("weights/k562/shallow_cnn/seed0.safetensors"))
p = predict(m, ["ACGT" * 250]) # probability of being a K562 cCRE; sequences must be equal length (trained on 1000 bp)
Use all five seeds of a model and report the spread; do not pick a "best seed" on test data.
Architectures
- ShallowCNN (7,937 parameters): Conv1d(4->128, k=15) -> ReLU -> global max pool -> dropout 0.3 -> linear.
- AttnCNN (189,185 parameters): Conv1d(4->128, k=15) -> ReLU -> MaxPool(4) -> Conv1d(128, k=7) -> ReLU -> 4-head self-attention with residual and LayerNorm -> mean+max pooling -> dropout 0.3 -> linear.
Training
Data: GC-matched table of the biosample; chromosome split train chr1-14, X, Y / validation chr15-18 / test chr19-22.
AdamW (weight decay 0.01), batch 256, mixed precision, reverse-complement augmentation, up to 60 epochs, early stopping on
validation AUROC (patience 8), ReduceLROnPlateau (factor 0.5, patience 2). Learning rate chosen from {3e-4, 1e-3, 3e-3} on
validation AUROC with seed 0 only; test chromosomes were never used for selection. Source: Kaggle kernel
purvanshj009/irg-07-cnn-tuned v2, git bc9f2fa, torch 2.11 (T4 GPU).
Evaluation (test chromosomes, mean ± SD over 5 seeds)
"Matched" = subset matched on GC and CpG observed/expected with equal positives and negatives per bin (a sub-population; not comparable with the full-task AUROC).
| biosample | model | lr | test AUROC | matched AUROC |
|---|---|---|---|---|
| tcell | ShallowCNN | 1e-3 | 0.886 ± 0.002 | 0.737 ± 0.004 |
| tcell | AttnCNN | 3e-3 | 0.891 ± 0.012 | 0.749 ± 0.026 |
| k562 | ShallowCNN | 3e-3 | 0.868 ± 0.002 | 0.768 ± 0.004 |
| k562 | AttnCNN | 3e-3 | 0.858 ± 0.007 | 0.749 ± 0.015 |
| gm12878 | ShallowCNN | 3e-3 | 0.847 ± 0.001 | 0.764 ± 0.002 |
| gm12878 | AttnCNN | 3e-3 | 0.848 ± 0.005 | 0.766 ± 0.009 |
Reference: an untuned XGBoost on 6-mer frequencies scores 0.881 / 0.863 / 0.834 (T cell / K562 / GM12878) on the full test set (single seed).
Full analysis and caveats: docs/results/cnn_tuned.md in the GitHub repository.
Intended use and limitations
- Research baselines for sequence-based cCRE classification and for testing interpretability methods. Not for clinical use or variant-effect prediction.
- Each model is specific to the biosample it was trained on; cross-biosample use is untested for these networks.
- The "negatives" are GC-matched genomic windows outside the biosample's cCREs, not validated non-regulatory elements.
- Gains over k-mer XGBoost are small (at most 0.014 AUROC on the full test set) and the XGBoost baseline was not tuned; AttnCNN beats it clearly only on GM12878 and is unstable on T cell.
- Five of six selected learning rates sit at the top of the sweep grid (3e-3), so the optimum may be higher.
- Composition shortcuts (GC, CpG) are controlled only in the matched evaluation; repeat content (Alu, L1) is not controlled here.
- Filter-to-motif correspondence has not been tested; do not read the filters as transcription-factor binding sites.
- Data note: the project's earlier tables named
k562_*were T-cell elements; these weights use the corrected v2.1 tables.
Provenance and integrity
Converted from PyTorch .pt to safetensors (no pickle). Every file was reloaded and checked for bit-identical tensors and
predictions against the original. Four models (seed-0 ShallowCNN for each biosample and seed-0 AttnCNN for K562) were re-scored on the
real test rows and reproduced the AUROC reported during training to four decimals (0.8877, 0.8671, 0.8464, 0.8705). The other 26 were
checked for identical tensors and predictions only, not re-scored on the test set.