Skip to main content

KESurv

PyPI Tests Docs License: MIT

KESurv estimates patient-specific survival curves from right-censored data. A survival forest supplies adaptive neighbor weights; user-selected survival models vote on which neighbors have similar predicted survival trajectories; a weighted Kaplan–Meier estimator produces the final curve.

Documentation: https://kesurv.statml.in

Install

pip install kesurv
pip install "kesurv[speed]"   # optional Numba acceleration

Quick start

from kesurv import KESurv
from sksurv.ensemble import RandomSurvivalForest
from sksurv.linear_model import CoxPHSurvivalAnalysis
from sksurv.tree import SurvivalTree

model = KESurv(
    base_estimators=[
        ("ridge", CoxPHSurvivalAnalysis(alpha=1.0)),
        ("tree", SurvivalTree(max_depth=4, random_state=1)),
    ],
    forest=RandomSurvivalForest(n_estimators=100, random_state=1),
    epsilon=0.05,
    min_agreement=1,
    n_timepoints=128,
    random_state=1,
)
model.fit(X_train, y_train)

model.predict_survival(X_test, times=[1, 3, 5])   # survival probabilities
model.predict_survival_function(X_test)           # step functions
model.predict_neighbor_info(X_test)               # forest weights, votes, fallbacks

X must be finite and numeric (encode categories and impute upstream). y is a structured (event, time) array, as built by sksurv.util.Surv.from_arrays. Any base learner with fit(X, y) and predict_survival_function(X) works; see the custom learner template.

Features

  • Any base learners. Use scikit-survival estimators or your own class.
  • Inspectable. predict_weights, predict_neighbor_info and kneighbors show exactly which training subjects shaped each curve.
  • Configurable similarity grid. Use similarity_time, n_timepoints or an explicit similarity_times grid.
  • Fast. Training leaves, bootstrap multiplicities and curves are cached at fit time. Queries run in batches over forest-supported candidates only. Numba kernels are optional.
  • Extra outputs. RMST (predict_rmst), risk scores (predict) and Harrell's C (score).

The weighted counting kernel builds on fastkme.

Development

pip install -e ".[test,docs]"
python -m pytest -q
python -m sphinx -b html -W --keep-going docs docs/_build/html

Citation

If you use KESurv, please cite KESurv: A Kernel Ensemble Method for Patient-Specific Survival Prediction, Proceedings of Machine Learning Research (ACML 2026).

License

MIT

Metadata

Release files for kesurv 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for kesurv 0.1.0
File Size Uploaded Provenance
kesurv-0.1.0.tar.gz 18.9 kB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for kesurv 0.1.0
File Interpreter ABI Platform
kesurv-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 32.7 kB

Release files / kesurv-0.1.0.tar.gz

Download URL kesurv-0.1.0.tar.gz
Size 18.9 kB
Tags Source
SHA-256 checksum
How to use checksums
3a5f0501da3e907da6dcb9baa39141a08645f1d49c9eb55a78bbe81f92da11ab
BLAKE2b-256 checksum
How to use checksums
8ef2fee199c348c87364a45210d713fca8dde78ef9ff0dc4073d657299c9c241
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 9, 2026.

Transparency log

Release files / kesurv-0.1.0-py3-none-any.whl

Download URL kesurv-0.1.0-py3-none-any.whl
Size 13.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
234df7b0b021b4f509d9c68084dd1307cedc9d95c5a590ee671e5222f5d4bb34
BLAKE2b-256 checksum
How to use checksums
beabe014b93c573f8db4bbf97b6472b007a0ad2ccdd227406dedd2bf08fd2ffe
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 9, 2026.

Transparency log

Security for kesurv 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for kesurv-0.1.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 9, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page