metrics¶
Brier scores for administrative censorship. |
|
Integrated Brier score for administrative censorship. |
|
Scikit-learn metric for Integral of brier scores for administrative censorship. |
|
Brier scores weighted with the inverse probability of censoring. |
|
Integrated Brier score weighted with the inverse probability of censoring. |
|
Scikit-learn metric wrapper for integrated Brier scores weighted with the inverse probability of censoring. |
|
administrative brier scores¶
- survivalpredict.metrics.brier_scores_administrative(predictions, times, events, max_time=None, times_start=None)¶
Brier scores for administrative censorship.
Administrative brier scores is appropriate in cases where censoring is a function of time. When a individual is marked as censored due to the fact that they have not experienced event at the last observed time, and not due to a lack of follow-up or drop out. This is ideal for industry, where churned/converted/failed individuals are often known with relative certainty.
Within survival analysis, each ‘outcome’ of the Brier scores is a distinct time within the survival curve. Administrative Brier scores simply look at the squared difference between the survival curve and the known survival; censored times for an individual are excluded from the score. The lower the scores, the better.
- Parameters:
predictions (np.ndarray) – Predicted survival curves.
times (np.ndarray) – True points in time that were last observed.
events (np.ndarray) – True indicators if event was experienced.
max_time (Optional[int], default=None) – Maximum time to evaluate survival curves. If None, will evaluate all times seen.
times_start (Optional[np.ndarray], default=None) – Starting point for observation. If not passed in, all times_start times are assumed to be 0.
- Returns:
Brier scores, starting from time 1 to max times.
- Return type:
ndarray of shape (n_samples, max_time), dtype=np.float64
References
[1] Kvamme, Håvard & Borgan, Ørnulf. (2019). The Brier Score under Administrative Censoring: Problems and Solutions. 10.48550/arXiv.1912.08581.
- survivalpredict.metrics.integrated_brier_score_administrative(predictions, times, events, max_time=None, times_start=None)¶
Integrated Brier score for administrative censorship.
Integral of Brier scores for administrative censorship, to allow for a singular metric of performance. Lower the better.
Administrative brier scores is appropriate in cases where censoring is a function of time. When a individual is marked as censored due to the fact that they have not experienced event at the last observed time, and not due to a lack of follow-up or drop out. This is ideal for industry, where churned/converted/failed individuals are often known with relative certainty.
Within survival analysis, each ‘outcome’ of the Brier scores is a distinct time within the survival curve. Administrative Brier scores simply look at the squared difference between the survival curve and the known survival; censored intervals are excluded from the score.
- Parameters:
predictions (np.ndarray) – Predicted survival curves.
times (np.ndarray) – True points in time that were last observed.
events (np.ndarray) – True indicators if event was experienced.
max_time (Optional[int], default=None) – Maximum time to evaluate survival curves. If None, will evaluate all times seen.
times_start (Optional[np.ndarray], default=None) – Starting point for observation. If not passed in, all times_start times are assumed to be 0.
- Returns:
Integral of Brier scores.
- Return type:
ndarray of shape (n_samples), dtype=np.float64
References
[1] Kvamme, Håvard & Borgan, Ørnulf. (2019). The Brier Score under Administrative Censoring: Problems and Solutions. 10.48550/arXiv.1912.08581.
- survivalpredict.metrics.integrated_brier_score_administrative_sklearn_metric(y_true, y_pred)¶
Scikit-learn metric for Integral of brier scores for administrative censorship.
- Parameters:
y_true (np.ndarray) – The true target; it is assumed, the target is generated from ‘survivalpredict.pipeline.build_sklearn_pipeline_target’.
y_pred (np.ndarray[tuple[int, int], np.dtype[np.floating]]) – Predicted survival curves from a ‘survivalpredict’ estimator.
- Return type:
float
- survivalpredict.metrics.integrated_brier_score_administrative_sklearn_scorer(estimator, X, y_true, *, sample_weight=None, **kwargs)¶
ipcw brier scores¶
- survivalpredict.metrics.brier_scores_ipcw(predictions, times, events, events_for_ipcw=None, times_for_ipcw=None, max_time=None)¶
Brier scores weighted with the inverse probability of censoring.
Brier score for cases where censoring includes drop-up or loss of follow-up, a common occurrence in medical research. Each point in time within the survival curve is treated as an ‘outcome’ in the scores. The squared difference between an estimated probability is weighted using an inverse-event estimation. Weights are generated with the multiplicative inverse of an event-switched Kaplan-Meier estimator , where the Boolean values of events are inverted. For each interval of time of interest, if an observation is censored or expeiences event, those scores are weighted with the inverted Kaplan-Meier value for the last known time of that observation. If an individual is believed to be ‘alive’ at the point in time of interest, said scores are weighted with that time of interest’s inverted Kaplan-Meier weights.
- Parameters:
predictions (np.ndarray[tuple[int,int],np.dtype[np.float64]]) – Predicted survival curves.
times (np.ndarray) – True points in time that were last observed.
events (np.ndarray) – True indicators if event was experienced.
events_for_ipcw (Optional[np.ndarray], default=None) – Events to build inverse probability of censoring weights on, it is acceptable to put in training events here. If None, will use Events.
times_for_ipcw (Optional[np.ndarray], default=None) – Times to build inverse probability of censoring weights on, it is acceptable to put in training times here. If None, will use Times.
max_time (Optional[int], default=None) – Maximum time to evaluate survival curves. If None, will evaluate all times seen.
- Returns:
Brier scores, starting from time 1 to max times.
- Return type:
np.ndarray
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. 17-18, pp. 2529–2545, 1999.
- survivalpredict.metrics.integrated_brier_score_ipcw(predictions, times, events, events_for_ipcw=None, times_for_ipcw=None, max_time=None)¶
Integrated Brier score weighted with the inverse probability of censoring.
Integral of Brier scores with inverse probability of censoring, to allow for a singular metric of performance. Lower the better.
Integral Brier scores for cases where censoring includes drop-up or loss of follow-up, a common occurrence in medical research. Each point in time within the survival curve is treated as an ‘outcome’ in the scores. The squared difference between an estimated probability is weighted using an inverse-event estimation. Weights are generated with the multiplicative inverse of an event-switched Kaplan-Meier estimator , where the Boolean values of events are inverted. For each interval of time of interest, if an observation is censored or expeiences event, those scores are weighted with the inverted Kaplan-Meier value for the last known time of that observation. If an individual is believed to be ‘alive’ at the point in time of interest, said scores are weighted with that time of interest’s inverted Kaplan-Meier weights.
- Parameters:
predictions (np.ndarray) – Predicted survival curves.
times (np.ndarray) – True points in time that were last observed.
events (np.ndarray) – True indicators if event was experienced.
events_for_ipcw (Optional[np.ndarray], default=None) – Events to build inverse probability of censoring weights on, it is acceptable to put in training events here. If None, will use Events.
times_for_ipcw (Optional[np.ndarray], default=None) – Times to build inverse probability of censoring weights on, it is acceptable to put in training times here. If None, will use Times.
max_time (Optional[int], default=None) – Maximum time to evaluate survival curves. If None, will evaluate all times seen.
- Returns:
Integral of Brier scores.
- Return type:
np.ndarray
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. 17-18, pp. 2529–2545, 1999.
- survivalpredict.metrics.integrated_brier_score_ipcw_sklearn_metric(y_true, y_pred)¶
Scikit-learn metric wrapper for integrated Brier scores weighted with the inverse probability of censoring.
- Parameters:
y_true (np.ndarray) – The true target; it is assumed, the target is generated from ‘survivalpredict.pipeline.build_sklearn_pipeline_target’.
y_pred (np.ndarray[tuple[int, int], np.dtype[np.floating]]) – Predicted survival curves from a ‘survivalpredict’ estimator.
- Return type:
float
- survivalpredict.metrics.integrated_brier_score_ipcw_sklearn_scorer(estimator, X, y_true, *, sample_weight=None, **kwargs)¶