skglm.CoxEstimator#

class skglm.CoxEstimator(alpha=1.0, l1_ratio=0.7, method='efron', tol=0.0001, max_iter=50, verbose=False)[source]#

Elastic Cox estimator with Efron and Breslow estimate.

Refer to Mathematics behind Cox datafit for details about the datafit expression. The data convention for the estimator is

  • X the design matrix with n_features predictors

  • y a two-column array where the first tm is of event time occurrences and the second s is of censoring.

For L2-regularized Cox (l1_ratio=0.) LBFGS is the used solver, otherwise it is ProxNewton.

Parameters:
alphafloat, optional

Penalty strength. It must be strictly positive.

l1_ratiofloat, default=0.5

The ElasticNet mixing parameter, with 0 <= l1_ratio <= 1. For l1_ratio = 0 the penalty is an L2 penalty. For l1_ratio = 1 it is an L1 penalty. For 0 < l1_ratio < 1, the penalty is a combination of L1 and L2.

method{‘efron’, ‘breslow’}, default=’efron’

The estimate used for the Cox datafit. Use efron to handle tied observations.

tolfloat, optional

Stopping criterion for the optimization.

max_iterint, optional

The maximum number of iterations to solve the problem.

verbosebool or int

Amount of verbosity.

Attributes:
coef_array, shape (n_features,)

Parameter vector of Cox regression.

stop_crit_float

The value of the stopping criterion at convergence.

__init__(alpha=1.0, l1_ratio=0.7, method='efron', tol=0.0001, max_iter=50, verbose=False)[source]#

Methods

__init__([alpha, l1_ratio, method, tol, ...])

fit(X, y)

Fit Cox estimator.

get_metadata_routing()

Get metadata routing of this object.

get_params([deep])

Get parameters for this estimator.

predict(X)

Predict using the linear model.

set_params(**params)

Set the parameters of this estimator.