survmetr
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.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
survmetr-0.1.0.tar.gz
(10.9 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
survmetr-0.1.0-py3-none-any.whl
(12.3 kB
view details)
File details
Details for the file survmetr-0.1.0.tar.gz.
File metadata
- Download URL: survmetr-0.1.0.tar.gz
- Upload date:
- Size: 10.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
87924090522d50bd9c7398abf3b049c8dcf7b863baf677fcd7ad5cd78fa16822
|
|
| MD5 |
71d489ee31a85bd691c7766517e33995
|
|
| BLAKE2b-256 |
14e9234ba6eb6864b5f1e80524978113d1dbd58f4b91bc7be31e2ec44ada59c9
|
File details
Details for the file survmetr-0.1.0-py3-none-any.whl.
File metadata
- Download URL: survmetr-0.1.0-py3-none-any.whl
- Upload date:
- Size: 12.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d113f1b42342bc65cda5477f7098b23096419e23afcd10fd5a50c341d659b05d
|
|
| MD5 |
adfecbfbe780f86d5a9a0ca25e1eddf8
|
|
| BLAKE2b-256 |
0c1d4ac5e505aba0c321e8fef10b0a7315459666cf5300f54daefc4b79b1c713
|