sksurv.linear_model.CoxnetSurvivalAnalysis¶

class
sksurv.linear_model.
CoxnetSurvivalAnalysis
(n_alphas=100, alphas=None, alpha_min_ratio=0.0001, l1_ratio=0.5, penalty_factor=None, normalize=False, copy_X=True, tol=1e07, max_iter=100000, verbose=False)¶ Cox’s proportional hazard’s model with elastic net penalty.
Parameters: n_alphas : int, optional, default: 100
Number of alphas along the regularization path.
alphas : arraylike or None, optional
List of alphas where to compute the models. If
None
alphas are set automatically.alpha_min_ratio : float, optional, default 0.0001
Determines minimum alpha of the regularization path if
alphas
isNone
. The smallest value for alpha is computed as the fraction of the data derived maximum alpha (i.e. the smallest value for which all coefficients are zero).l1_ratio : float, optional, default: 0.5
The ElasticNet mixing parameter, with
0 < l1_ratio <= 1
. Forl1_ratio = 0
the penalty is an L2 penalty. Forl1_ratio = 1
it is an L1 penalty. For0 < l1_ratio < 1
, the penalty is a combination of L1 and L2.penalty_factor : arraylike or None, optional
Separate penalty factors can be applied to each coefficient. This is a number that multiplies alpha to allow differential shrinkage. Can be 0 for some variables, which implies no shrinkage, and that variable is always included in the model. Default is 1 for all variables. Note: the penalty factors are internally rescaled to sum to n_features, and the alphas sequence will reflect this change.
normalize : boolean, optional, default: False
If True, the features X will be normalized before optimization by subtracting the mean and dividing by the l2norm. If you wish to standardize, please use
sklearn.preprocessing.StandardScaler
before callingfit
on an estimator withnormalize=False
.copy_X : boolean, optional, default: True
If
True
, X will be copied; else, it may be overwritten.tol : float, optional, default: 1e7
The tolerance for the optimization: optimization continues until all updates are smaller than
tol
.max_iter : int, optional, default: 100000
The maximum number of iterations.
verbose : bool, optional, default: False
Whether to print additional information during optimization.
References
[R46] Simon N, Friedman J, Hastie T, Tibshirani R. Regularization paths for Cox’s proportional hazards model via coordinate descent. Journal of statistical software. 2011 Mar;39(5):1. Attributes
alphas_ (ndarray, shape=(n_alphas,)) The actual sequence of alpha values used. penalty_factor_ (ndarray, shape=(n_features,)) The actual penalty factors used. coef_ (ndarray, shape=(n_features, n_alphas)) Matrix of coefficients. deviance_ratio_ (ndarray, shape=(n_alphas,)) The fraction of (null) deviance explained. 
__init__
(n_alphas=100, alphas=None, alpha_min_ratio=0.0001, l1_ratio=0.5, penalty_factor=None, normalize=False, copy_X=True, tol=1e07, max_iter=100000, verbose=False)¶
Methods
__init__
([n_alphas, alphas, …])fit
(X, y)Fit estimator. predict
(X[, alpha])The linear predictor of the model. score
(X, y)
fit
(X, y)¶ Fit estimator.
Parameters: X : arraylike, 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, alpha=None)¶ The linear predictor of the model.
Parameters: X : arraylike, shape = (n_samples, n_features)
Test data of which to calculate loglikelihood from
alpha : float, optional
Constant that multiplies the penalty terms. If the same alpha was used during training, exact coefficients are used, otherwise coefficients are interpolated from the closest alpha values that were used during training. If set to
None
, the last alpha in the solution path is used.Returns: T : array, shape = (n_samples,)
The predicted decision function
