Skip to content
yayapaPublic

About

No description, website, or topics provided.

Resources

Stars

11 stars

Watchers

2 watching

Forks

Repository files navigation

SIC

Survival In-Context: Amortized Bayesian Survival Analysis via Prior-Fitted Networks

arXiv Hugging Face License Cite

Installation  ·  Quick start  ·  Examples  ·  Benchmarking  ·  Prior  ·  Cite


Note

November 2026: A new version of SIC, accompanied by a new preprint (v3 on arXiv): a better prior, a continuous-time survival head, better calibration and discrimination, and superior performance across 58 publicly accessible datasets, ranging from 100 to 280,845 samples, 3 to 160 raw features, and 0.066 to 0.945 censoring rates.

The official implementation of the paper Survival In-Context: Amortized Bayesian Survival Analysis via Prior-Fitted Networks

SIC brings the PFN and ICL paradigms to survival analysis. SIC requires no hyperparameter tuning and no training, performing predictions using the training dataset as context.

Installation

With these steps you can develop and change the model as well as execute on your own datasets. (You may want to omit some steps to use the package as-is.)

Using Conda

git clone https://github.com/yayapa/sic
cd sic
conda env create -f env.yml      # installs the package editable with [dev] extras
conda activate sic
pip install -e .

Note 1: For installing pre-commit hooks you can use (not necessary for the usage): pip install -e ".[dev]" then run bash scripts/install-git-hooks.sh.

Note 2: Model weights and the bundled benchmark data are hosted at yayapa/sic and downloaded automatically on first use, then cached locally. Override the source repo with the SIC_HF_REPO environment variable and the cache/download location with SIC_CACHE_DIR (or the standard HF_HOME).

Using uv

git clone https://github.com/yayapa/sic
cd sic
uv sync

Quick start

from sic import SIC, make_y, load_dataset

data = load_dataset("METABRIC")
X, t, e = data["x"], data["t"], data["e"]

# split however you like
X_train, X_test = X.iloc[:1500], X.iloc[1500:]
y_train = make_y(t[:1500], e[:1500])          # scikit-survival style labels

model = SIC()   
surv = model.fit_predict_surv(
    X_train, y_train, X_test,
    eval_times=[1, 2, 3, 4, 5],             # years; None -> model-native grid
)
# surv: DataFrame, index = eval_times, columns = test subjects (EvalSurv convention)

Examples

Everything you need to know about running the model is in the example notebooks:

  • examples/sic_walkthrough.ipynb - notebook tour of SIC: evaluation with C-index and IBS, survival curves, and 5-fold CV with CSV/JSON output.
  • examples/inspect_prior_batch.ipynb - load one synthetic prior batch: Kaplan–Meier curves, observed event / censoring times, and a Cox PH sanity check.

Survival heads

SIC uses the SuMoPP (SuMo++) head by default: a continuous-time head whose survival curve S(t|x) is monotone in t with S(0)=1, with time scaled by the p95 of the training durations. Its checkpoint is released and downloads automatically.

You can also train SIC with other survival heads (see Generating Prior and training your own model). We do not provide checkpoints for these heads yet.

survival_head model output training script
SuMoPP (default) SuMo++ (MONDE+) continuous S(t,x); monotone in t with S(0)=1 exact run_train_sumopp.sh
SuMo SuMo-net (MrHuff) continuous S(t,x); mixed monotone-in-t run_train_sumo.sh
CoxPH proportional hazards 1 log-hazard / subject run_train_coxph.sh
DeepEH extended hazard 2 hazards / subject run_train_deepeh.sh
DeepHit10 discrete-time DeepHit 10 bins (adjustable via --num_bins) run_train_deephit10.sh

To use a head you trained yourself, pass its checkpoint: SIC(survival_head="SuMo", model_path="/path/to/step-10000.ckpt").

Benchmarking

sic.list_datasets() returns the benchmark: all SurvSet datasets (55, smallest first), METABRIC (bundled with the package), and SEER / UNOS if available. The SurvSet datasets need the optional extra:

pip install -e ".[survset]"
bash examples/run_eval_survset.sh                 # whole benchmark, released SIC weights
python examples/run_eval_survset.py --model_path /path/to/model.ckpt --datasets hdfail METABRIC

Both write the per-fold metrics to .xlsx and .json.

The restricted-access SEER and UNOS datasets are not distributed. If you have access, put seernfg.csv / unos.csv in a folder and pass --data_dir (or set SIC_DATA_DIR); they are then added to the benchmark automatically.

Generating Prior and training your own model

See examples/ for scripts and notebooks. Workflow:

bash examples/run_genload_continuous.sh   # synthetic continuous priors
bash examples/run_genload_discrete.sh     # synthetic discrete priors
bash examples/run_train_sumopp.sh         # train SIC with the default head (run genload first)

Other heads: run_train_sumo.sh, run_train_deephit10.sh, run_train_deepeh.sh, run_train_coxph.sh. Edit paths and hyperparameters at the top of each script (or export DATA_ROOT, CHECKPOINT_ROOT, CHECKPOINT_PATH). Inspect a prior batch: examples/inspect_prior_batch.ipynb.

wandb: the training scripts log to wandb by default (--wandb_mode online). Set WANDB_API_KEY or run wandb login (requires wandb ≥ 0.22.3 for current API keys). Use --wandb_mode offline or --wandb_log False to skip cloud logging.

Baselines

To increase readability, we plan to release the code for training baselines using hyperparameter tuning in optuna as a separate repository later. TODO

Acknowledgments

We thank Adil for implementing the SuMo++ Head.

We thank the authors of TabICL for making PFNs open source! We used their codebase to develop our model.

Additionally, we actively used in the development torchsurv. We thank the authors for making their code public.

LLM Note

The original research code was written by yayapa. However, for refactoring and publishing the package, LLMs and agentic mode have been actively used. If you see any problems, please report them using issues.

Citation

@article{seletkov26sic,
  title         = {Survival In-Context: Amortized Bayesian Survival Analysis via Prior-Fitted Networks},
  author        = {Seletkov, Dmitrii and Hager, Paul and Kaissis, Georgios, and Braren, Rickmer and Rueckert, Daniel and Rehms, Raphael},
  journal       = {arXiv preprint arXiv:2603.29475},
  year          = {2026},
  eprint        = {2603.29475},
  archivePrefix = {arXiv},
  primaryClass  = {cs.LG}
}

License

MIT (see LICENSE). Includes code derived from TabICL (BSD 3-Clause) and a vendored copy of TorchSurv (MIT). See THIRD_PARTY_NOTICES.

About

No description, website, or topics provided.

Resources

Stars

11 stars

Watchers

2 watching

Forks

Releases

Packages

Contributors

Languages