hazardous.metrics.brier_score_incidence#

hazardous.metrics.brier_score_incidence(y_train, y_test, y_pred, times, event_of_interest='any')#

Time-dependent Brier score for the kth cause of event.

\[\mathrm{BS}_k(t) = \frac{1}{n} \sum_{i=1}^n \hat{\omega}_i(t) (\mathbb{I}(t_i \leq t, \delta_i = k) - \hat{F}_k(t|\mathbf{x}_i))^2\]

where \(\hat{F}_k(t | \mathbf{x}_i)\) is an estimate of the (uncensored) cumulative incidence for the kth event up to time point \(t\) for a feature vector \(\mathbf{x}_i\) [Edwards2016]:

\[\hat{F}_k(t | \mathbf{x}_i) \approx P(T_i \leq t, \Delta_i = k | \mathbf{x}_i)\]

and \(\hat{\omega}_i(t)\) are IPCW weigths based on the Kaplan-Meier estimate of the censoring distribution \(\hat{G}(t)\):

\[\hat{\omega}_i(t)=\frac{\mathbb{I}(t_i \leq t, \delta_i \neq 0)}{\hat{G}(t_i)} + \frac{\mathbb{I}(t_i > t)}{\hat{G}(t)}\]

This scheme was introduced in [Graf1999] in the context of survival analysis and extended to competing events in [Kretowska2018].

Note that this assumes independence between censoring and the covariates. When this assumption is violated, the IPCW weights are biased and the Brier score is not a proper scoring rule anymore. See [Gerds2006] for a study of this bias.

Parameters:
y_trainrecord-array, dictionnary or dataframe of shape (n_samples, 2)

The target, consisting in the ‘event’ and ‘duration’ columns. This is used to fit the IPCW estimator.

y_testrecord-array, dictionnary or dataframe of shape (n_samples, 2)

The ground truth, consisting in the ‘event’ and ‘duration’ columns. In the “event” column, 0 indicates censoring, and any other values indicate competing event types.

y_predarray-like of shape (n_samples, n_times)

Incidence probability estimates predicted at times. In the binary event settings, this is 1 - survival_probability.

timesarray-like of shape (n_times)

Times at which the survival probability y_pred has been estimated and for which we compute the Brier score.

event_of_interestint or “any”, default=”any”

The event to consider in a competing events setting. When an integer, this should be one of the non-zero values in the “event” column of y_train and y_test.

"any" indicates that all events except the censoring marker 0 are considered collapsed together as a single event. In a single event setting, "any" and 1 are equivalent.

Returns:
brier_scorenp.ndarray of shape (n_times)

See also

integrated_brier_score_incidence

Time-integrated Brier score for the kth cause of event.

References

[Graf1999]

E. Graf, C. Schmoor, W. Sauerbrei, M. Schumacher, “Assessment and comparison of prognostic classification schemes for survival data”, 1999

[Kretowska2018]

M. Kretowska, “Tree-based models for survival data with competing risks”, 2018

[Gerds2006]

T. Gerds and M. Schumacher, “Consistent Estimation of the Expected Brier Score in General Survival Models with Right-Censored Event Times”, 2006

[Edwards2016]

J. Edwards, L. Hester, M. Gokhale, C. Lesko, “Methodologic Issues When Estimating Risks in Pharmacoepidemiology.”, 2016, doi:10.1007/s40471-016-0089-1