Skip to content

tausurv.linear.coxnet

class Coxnet(*, n_alphas: int = 100, alphas: float | ArrayLike | None = None, alpha_min_ratio: float | Literal['auto'] = 'auto', l1_ratio: float = 0.5, penalty_factor: ArrayLike | None = None, copy_X: bool = True, tol: float = 1e-07, max_iter: int = 100000, verbose: bool = False, standardize: bool = True)

Cox proportional hazards with an elastic-net penalty.

A wrapper around scikit-survival’s CoxnetSurvivalAnalysis, which fits a regularisation path by coordinate descent (Simon et al., 2011) and keeps the last model on the path for prediction. Needs the sksurv extra: pip install tausurv[sksurv].

  • n_alphas — int, default 100 — Number of penalty strengths along the regularisation path; ignored when alphas is given.
  • alphas — float or (k,) array-like, optional — Explicit penalty strengths. A single float fits one model.
  • alpha_min_ratio — float or “auto”, default “auto” — Ratio of the smallest to the largest penalty on the automatic path.
  • l1_ratio — float, default 0.5 — Elastic-net mixing in [0,1][0, 1]: 11 is the lasso, 00 ridge.
  • penalty_factor — (d,) array-like, optional — Per-coefficient multipliers of the penalty; 00 leaves a coefficient unpenalised.
  • copy_X — bool, default True — Whether scikit-survival copies the covariates before fitting.
  • tol — float, default 1e-7 — Convergence tolerance of the coordinate descent.
  • max_iter — int, default 100000 — Iteration cap of the coordinate descent.
  • verbose — bool, default False — Forwarded to scikit-survival.
  • standardize — bool, default True — Centre and scale the covariates before fitting and prediction. The coefficients in coef_ are then on the standardised scale.
  • times_ — (k,) array — Unique training event times, the model’s natural time grid.
  • coef_ — (d,) array — Coefficients of the last model on the path, on the standardised scale when standardize is True.

Simon, N., Friedman, J., Hastie, T., Tibshirani, R. (2011). Regularization paths for Cox’s proportional hazards model via coordinate descent. Journal of Statistical Software, 39(5).