survivalpredict.estimators.AalenAdditiveHazard¶
- class survivalpredict.estimators.AalenAdditiveHazard(clip_hazards=True, alpha=0.0)¶
Aalen Additive Hazards.
Aalen Additive Hazards is a linear multivariate non-parametric estimation of hazard. It allows for each interval of time and feature to have an associated coefficient, allowing for the effects of features to change over time. Aalen Additive Hazards simply runs (ridge) linear regressions at different points in time, 1 if the event and 0 otherwise , censored times are ignored. The results of the linear regressions are used for generating hazards and ultimately survival curves. AalenAdditiveHazard models are tricky to train.
- Parameters:
clip_hazards (bool, default=True) – If True, clips hazards to be between 0 and 1. Ensuring that hazard values are realistic.
alpha (float, default=0.0) – Constant that multiplies the penalty terms. Used to penalize coefficients durring training.
- _hazard_weights¶
Coefficients of the model.
- Type:
ndarray of ndarray of shape (n_features,n)
- _hazard_weights_times¶
Times associated for each interval of time in the _hazard_weights array.
- Type:
ndarray of ndarray of shape (n)
Methods
fit(X, times, events[, check_input, times_start])Fit model.
fit_predict(*args, **kwargs)Fit model and Build survival curves.
predict(X[, max_time])Build survival curves on an array of vectors X.
- __init__(clip_hazards=True, alpha=0.0)¶
- Parameters:
clip_hazards (bool)
alpha (float)
Methods
__init__([clip_hazards, alpha])fit(X, times, events[, check_input, times_start])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[, 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])Configure whether metadata should be requested to be passed to the
predictmethod.- fit(X, times, events, 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.
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, max_time=None)¶
Build survival curves on an array of vectors X.
- Parameters:
X (array-like of shape (n_samples, n_features)) – Predicting data.
max_time (Optional[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