sksurv.metrics.integrated_brier_score¶

sksurv.metrics.
integrated_brier_score
(survival_train, survival_test, estimate, times)[source]¶ The Integrated Brier Score (IBS) provides an overall calculation of the model performance at all available times \(t_1 \leq t \leq t_\text{max}\).
The integrated timedependent Brier score over the interval \([t_1; t_\text{max}]\) is defined as
\[\mathrm{IBS} = \int_{t_1}^{t_\text{max}} \mathrm{BS}^c(t) d w(t)\]where the weighting function is \(w(t) = t / t_\text{max}\). The integral is estimated via the trapezoidal rule.
See [1] for further details.
Parameters:  survival_train (structured array, shape = (n_train_samples,)) – Survival times for training data to estimate the censoring distribution from. A structured array containing the binary event indicator as first field, and time of event or time of censoring as second field.
 survival_test (structured array, shape = (n_samples,)) – Survival times of test data. A structured array containing the binary event indicator as first field, and time of event or time of censoring as second field.
 estimate (arraylike, shape = (n_samples, n_times)) – Estimated risk of experiencing an event for test data at times. The ith column must contain the estimated probability of remaining eventfree up to the ith time point.
 times (arraylike, shape = (n_times,)) – The time points for which to estimate the Brier score. Values must be within the range of followup times of the test data survival_test.
Returns: ibs – The integrated Brier score.
Return type: float
Examples
>>> import numpy >>> from sksurv.datasets import load_gbsg2 >>> from sksurv.linear_model import CoxPHSurvivalAnalysis >>> from sksurv.metrics import integrated_brier_score >>> from sksurv.preprocessing import OneHotEncoder
Load and prepare data.
>>> X, y = load_gbsg2() >>> X.loc[:, "tgrade"] = X.loc[:, "tgrade"].map(len).astype(int) >>> Xt = OneHotEncoder().fit_transform(X)
Fit a Cox model.
>>> est = CoxPHSurvivalAnalysis(ties="efron").fit(Xt, y)
Retrieve individual survival functions and get probability of remaining event free from 1 year to 5 years (=1825 days).
>>> survs = est.predict_survival_function(Xt) >>> times = numpy.arange(365, 1826) >>> preds = numpy.asarray([[fn(t) for t in times for fn in survs]])
Compute the integrated Brier score from 1 to 5 years.
>>> score = integrated_brier_score(y, y, preds, times) >>> print(score) 0.1815853064627424
See also
References
[1] E. Graf, C. Schmoor, W. Sauerbrei, and M. Schumacher, “Assessment and comparison of prognostic classification schemes for survival data,” Statistics in Medicine, vol. 18, no. 1718, pp. 2529–2545, 1999.