Skip to main content

survmetr

License: LGPL v3

Advanced predictive metrics for survival analysis, focused on Antolini's time-dependent concordance index.

Installation

pip install survmetr

For numba-accelerated computation:

pip install survmetr[numba]

Quick Start

import numpy as np
from sksurv.util import Surv
from survmetr import c_index_antolini

# Create survival data
y = Surv.from_arrays(
    event=[True, True, False, True, False],
    time=[1.0, 3.0, 4.0, 5.0, 6.0],
)
n_events = y['event'].sum()

# Prediction matrix: (n_samples, n_events) failure probabilities
estimate = np.random.rand(len(y), n_events)

# Compute Antolini's time-dependent C-index
c = c_index_antolini(estimate, y)
print(f"C-index: {c:.3f}")

# Get detailed statistics
result = c_index_antolini(estimate, y, return_all=True)
print(result)
# {'c-index': ..., 'concordant': ..., 'comparable': ...,
#  'tied_risk': ..., 'discordant': ..., 'numerator': ...}

Available Metrics

Function Description
c_index_antolini Antolini's time-dependent C-index (alias for vector impl)
c_index_antolini_vector Vectorized NumPy implementation
c_index_antolini_sksurv Implementation using scikit-survival internals
c_index_antolini_pycox Numba-JIT parallel implementation
make_survival_scorer Factory for time-dependent classification scorers
harrel_c_index_scorer Harrell's standard C-index scorer
AntoliniCIndexVecScorer Dataclass scorer for the vector implementation
split_y Extract event/time from structured arrays

Tutorial

See Tutorial.ipynb for a detailed walkthrough.

License

This project is licensed under the GNU Lesser General Public License v3.0 - see the LICENSE file for details.

Metadata

Release files for survmetr 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 survmetr 0.1.0
File Size Uploaded Provenance
survmetr-0.1.0.tar.gz 10.9 kB Without provenance Details

Built distribution (wheel)

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

Total release size: 23.2 kB

Release files / survmetr-0.1.0.tar.gz

Download URL survmetr-0.1.0.tar.gz
Size 10.9 kB
Tags Source
SHA-256 checksum
How to use checksums
87924090522d50bd9c7398abf3b049c8dcf7b863baf677fcd7ad5cd78fa16822
BLAKE2b-256 checksum
How to use checksums
14e9234ba6eb6864b5f1e80524978113d1dbd58f4b91bc7be31e2ec44ada59c9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.3

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

Download URL survmetr-0.1.0-py3-none-any.whl
Size 12.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d113f1b42342bc65cda5477f7098b23096419e23afcd10fd5a50c341d659b05d
BLAKE2b-256 checksum
How to use checksums
0c1d4ac5e505aba0c321e8fef10b0a7315459666cf5300f54daefc4b79b1c713
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.3

Security for survmetr 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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

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 No 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