survivalpredict.estimators.KaplanMeierSurvivalEstimator¶
- class survivalpredict.estimators.KaplanMeierSurvivalEstimator¶
The Kaplan-Meier estimate of the survival estimation.
Kaplan-Meier is a univariate non-parametric survival curve estimation. It can be useful as a baseline/dummy estimator.
Methods
fit(X, times, events[, strata, check_input, ...])Fit model.
fit_predict(*args, **kwargs)Fit model and Build survival curves.
predict(X[, strata, max_time])Build survival curves on an array of vectors X.
- __init__(*args, **kwargs)¶
Methods
__init__(*args, **kwargs)fit(X, times, events[, strata, check_input, ...])Fit model.
fit_predict(*args, **kwargs)Fit model and Build survival curves.
get_metadata_routing()Get metadata routing of this object.
get_params([deep])Get parameters for this estimator.
predict(X[, strata, max_time])Build survival curves on an array of vectors X.
set_fit_request(*[, check_input, events, ...])Configure whether metadata should be requested to be passed to the
fitmethod.set_params(**params)Set the parameters of this estimator.
set_predict_request(*[, max_time, strata])Configure whether metadata should be requested to be passed to the
predictmethod.- fit(X, times, events, strata=None, check_input=True, times_start=None)¶
Fit model.
- Parameters:
X (array-like of shape (n_samples, n_features)) – Training data.
times (array-like of shape (n_samples), dtype=np.int64) – Point in time last observed.
events (array-like of shape (n_samples), dtype=np.bool_) – Experianed event.
strata (array-like of shape (n_samples,), dtype=np.int64, default=None) – If passed in, associated strata for per observation.
check_input (bool, default=True) – If True, validates and casts inputs.
times_start (array-like of shape (n_samples, dtype=np.int64), default=None) – Starting point for observation. If not passed in, all times_start times are assumed to be 0.
- Returns:
Fitted Estimator.
- Return type:
object
- fit_predict(*args, **kwargs)¶
Fit model and Build survival curves.
- predict(X, strata=None, max_time=None)¶
Build survival curves on an array of vectors X.
- Parameters:
X (array-like of shape (n_samples, n_features)) – Predicting data.
strata (array-like of shape (n_samples,), dtype=np.int64, default=None) – If passed in, associated strata for per observation.
max_time (int, default=None) – Maximum time of built survival curves. If none, maximum time is max time seen on training data.
- Returns:
The estimated survival curves, the left-most column is the probability of survival at time 1, and the right-most column ends at max_time.
- Return type:
ndarray of shape (n_samples, max_time), dtype=np.float64