sksurv.linear_model.CoxPHSurvivalAnalysis

class sksurv.linear_model.CoxPHSurvivalAnalysis(alpha=0, n_iter=100, tol=1e-09, verbose=0)

Cox proportional hazards model.

Uses the Breslow method to handle ties and Newton-Raphson optimization.

Parameters:

alpha : float, optional, default: 0

Regularization parameter for ridge regression penalty.

n_iter : int, optional, default: 100

Maximum number of iterations.

tol : float, optional, default: 1e-9

Convergence criteria. Convergence is based on the negative log-likelihood:

|1 - (new neg. log-likelihood / old neg. log-likelihood) | < tol

verbose : int, optional, default: 0

Specified the amount of additional debug information during optimization.

References

[R45]Cox, D. R. Regression models and life tables (with discussion). Journal of the Royal Statistical Society. Series B, 34, 187-220, 1972.

Attributes

coef_ (ndarray, shape = (n_features,)) Coefficients of the model
cum_baseline_hazard_ (sksurv.functions.StepFunction) Estimated baseline cumulative hazard function.
baseline_survival_ (sksurv.functions.StepFunction) Estimated baseline survival function.
__init__(alpha=0, n_iter=100, tol=1e-09, verbose=0)

Methods

__init__([alpha, n_iter, tol, verbose])
fit(X, y) Minimize negative partial log-likelihood for provided data.
predict(X) Predict risk scores.
predict_cumulative_hazard_function(X) Predict cumulative hazard function.
predict_survival_function(X) Predict survival function.
score(X, y)
fit(X, y)

Minimize negative partial log-likelihood for provided data.

Parameters:

X : array-like, shape = (n_samples, n_features)

Data matrix

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.

Returns:

self

predict(X)

Predict risk scores.

Parameters:

X : array-like, shape = (n_samples, n_features)

Data matrix.

Returns:

risk_score : array, shape = (n_samples,)

Predicted risk scores.

predict_cumulative_hazard_function(X)

Predict cumulative hazard function.

The cumulative hazard function for an individual with feature vector \(x\) is defined as

\[H(t \mid x) = \exp(x^\top \beta) H_0(t) ,\]

where \(H_0(t)\) is the baseline hazard function, estimated by Breslow’s estimator.

Parameters:

X : array-like, shape = (n_samples, n_features)

Data matrix.

Returns:

cum_hazard : ndarray, shape = (n_samples,)

Predicted cumulative hazard functions.

predict_survival_function(X)

Predict survival function.

The survival function for an individual with feature vector \(x\) is defined as

\[S(t \mid x) = S_0(t)^{\exp(x^\top \beta)} ,\]

where \(S_0(t)\) is the baseline survival function, estimated by Breslow’s estimator.

Parameters:

X : array-like, shape = (n_samples, n_features)

Data matrix.

Returns:

survival : ndarray, shape = (n_samples,)

Predicted survival functions.