sksurv.svm.MinlipSurvivalAnalysis#

class sksurv.svm.MinlipSurvivalAnalysis(solver='ecos', alpha=1.0, kernel='linear', gamma=None, degree=3, coef0=1, kernel_params=None, pairs='nearest', verbose=False, timeit=None, max_iter=None)[source]#

Survival model related to survival SVM, using a minimal Lipschitz smoothness strategy instead of a maximal margin strategy.

\[ \begin{align}\begin{aligned}\begin{split}\min_{\mathbf{w}}\quad \frac{1}{2} \lVert \mathbf{w} \rVert_2^2 + \gamma \sum_{i = 1}^n \xi_i \\ \text{subject to}\quad \mathbf{w}^\top \mathbf{x}_i - \mathbf{w}^\top \mathbf{x}_j \geq y_i - y_j - \xi_i,\quad \forall (i, j) \in \mathcal{P}_\text{1-NN}, \\ \xi_i \geq 0,\quad \forall i = 1,\dots,n.\end{split}\\\mathcal{P}_\text{1-NN} = \{ (i, j) \mid y_i > y_j \land \delta_j = 1 \land \nexists k : y_i > y_k > y_j \land \delta_k = 1 \}_{i,j=1}^n.\end{aligned}\end{align} \]

See 1 for further description.

Parameters
  • solver ("ecos" | "osqp", optional, default: ecos) – Which quadratic program solver to use.

  • alpha (float, positive, default: 1) – Weight of penalizing the hinge loss in the objective function.

  • kernel ("linear" | "poly" | "rbf" | "sigmoid" | "cosine" | "precomputed") – Kernel. Default: “linear”

  • gamma (float, optional) – Kernel coefficient for rbf and poly kernels. Default: 1/n_features. Ignored by other kernels.

  • degree (int, default: 3) – Degree for poly kernels. Ignored by other kernels.

  • coef0 (float, optional) – Independent term in poly and sigmoid kernels. Ignored by other kernels.

  • kernel_params (mapping of string to any, optional) – Parameters (keyword arguments) and values for kernel passed as call

  • pairs ("all" | "nearest" | "next", optional, default: "nearest") –

    Which constraints to use in the optimization problem.

    • all: Use all comparable pairs. Scales quadratic in number of samples (cf. sksurv.svm.HingeLossSurvivalSVM).

    • nearest: Only considers comparable pairs \((i, j)\) where \(j\) is the uncensored sample with highest survival time smaller than \(y_i\). Scales linear in number of samples.

    • next: Only compare against direct nearest neighbor according to observed time, disregarding its censoring status. Scales linear in number of samples.

  • verbose (bool, default: False) – Enable verbose output of solver

  • timeit (False or int) – If non-zero value is provided the time it takes for optimization is measured. The given number of repetitions are performed. Results can be accessed from the timings_ attribute.

  • max_iter (int, optional) – Maximum number of iterations to perform. By default use solver’s default value.

X_fit_#

Training data.

Type

ndarray

coef_#

Coefficients of the features in the decision function.

Type

ndarray, shape = (n_samples,)

n_features_in_#

Number of features seen during fit.

Type

int

feature_names_in_#

Names of features seen during fit. Defined only when X has feature names that are all strings.

Type

ndarray of shape (n_features_in_,)

n_iter_#

Number of iterations run by the optimization routine to fit the model.

Type

int

References

1

Van Belle, V., Pelckmans, K., Suykens, J. A. K., and Van Huffel, S. Learning transformation models for ranking and survival analysis. The Journal of Machine Learning Research, 12, 819-862. 2011

__init__(solver='ecos', alpha=1.0, kernel='linear', gamma=None, degree=3, coef0=1, kernel_params=None, pairs='nearest', verbose=False, timeit=None, max_iter=None)[source]#

Methods

__init__([solver, alpha, kernel, gamma, ...])

fit(X, y)

Build a MINLIP survival model from training data.

get_params([deep])

Get parameters for this estimator.

predict(X)

Predict risk score of experiencing an event.

score(X, y)

Returns the concordance index of the prediction.

set_params(**params)

Set the parameters of this estimator.

fit(X, y)[source]#

Build a MINLIP survival model from training 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.

Return type

self

get_params(deep=True)#

Get parameters for this estimator.

Parameters

deep (bool, default=True) – If True, will return the parameters for this estimator and contained subobjects that are estimators.

Returns

params – Parameter names mapped to their values.

Return type

dict

predict(X)[source]#

Predict risk score of experiencing an event.

Higher scores indicate shorter survival (high risk), lower scores longer survival (low risk).

Parameters

X (array-like, shape = (n_samples, n_features)) – The input samples.

Returns

y – Predicted risk.

Return type

ndarray, shape = (n_samples,)

score(X, y)[source]#

Returns the concordance index of the prediction.

Parameters
  • X (array-like, shape = (n_samples, n_features)) – Test samples.

  • 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

cindex – Estimated concordance index.

Return type

float

set_params(**params)#

Set the parameters of this estimator.

The method works on simple estimators as well as on nested objects (such as Pipeline). The latter have parameters of the form <component>__<parameter> so that it’s possible to update each component of a nested object.

Parameters

**params (dict) – Estimator parameters.

Returns

self – Estimator instance.

Return type

estimator instance