sksurv.nonparametric.SurvivalFunctionEstimator#

class sksurv.nonparametric.SurvivalFunctionEstimator(conf_level=0.95, conf_type=None)[source]#

Kaplan–Meier estimate of the survival function.

Parameters
  • conf_level (float, optional, default: 0.95) – The level for a two-sided confidence interval on the survival curves.

  • conf_type (None or {'log-log'}, optional, default: 'log-log'.) – The type of confidence intervals to estimate. If None, no confidence intervals are estimated. If “log-log”, estimate confidence intervals using the log hazard or \(log(-log(S(t)))\).

See also

sksurv.nonparametric.kaplan_meier_estimator

Functional API of the Kaplan-Meier estimator.

__init__(conf_level=0.95, conf_type=None)[source]#

Methods

__init__([conf_level, conf_type])

fit(y)

Estimate survival distribution from training data.

get_params([deep])

Get parameters for this estimator.

predict_proba(time[, return_conf_int])

Return probability of an event after given time point.

set_params(**params)

Set the parameters of this estimator.

fit(y)[source]#

Estimate survival distribution from training data.

Parameters

y (structured array, shape = (n_samples,)) – A structured array containing the binary event indicator as first field, and time of event or time of censoring as second field.

Return type

self

get_params(deep=True)#

Get parameters for this estimator.

Parameters

deep (bool, default=True) – If True, will return the parameters for this estimator and contained subobjects that are estimators.

Returns

params – Parameter names mapped to their values.

Return type

dict

predict_proba(time, return_conf_int=False)[source]#

Return probability of an event after given time point.

\(\hat{S}(t) = P(T > t)\)

Parameters
  • time (array, shape = (n_samples,)) – Time to estimate probability at.

  • return_conf_int (bool, optional, default: False) – Whether to return the pointwise confidence interval of the survival function. Only available if fit() has been called with the conf_type parameter set.

Returns

  • prob (array, shape = (n_samples,)) – Probability of an event at the passed time points.

  • conf_int (array, shape = (2, n_samples)) – Pointwise confidence interval at the passed time points. Only provided if return_conf_int is True.

set_params(**params)#

Set the parameters of this estimator.

The method works on simple estimators as well as on nested objects (such as Pipeline). The latter have parameters of the form <component>__<parameter> so that it’s possible to update each component of a nested object.

Parameters

**params (dict) – Estimator parameters.

Returns

self – Estimator instance.

Return type

estimator instance