sksurv.svm.HingeLossSurvivalSVM¶

class
sksurv.svm.
HingeLossSurvivalSVM
(solver='cvxpy', alpha=1.0, kernel='linear', gamma=None, degree=3, coef0=1, kernel_params=None, pairs='all', verbose=False, timeit=None, max_iter=None)[source]¶ Naive implementation of kernel survival support vector machine.
A new set of samples is created by building the difference between any two feature vectors in the original data, thus this version requires \(O(\text{n_samples}^4)\) space and \(O(\text{n_samples}^6 \cdot \text{n_features})\).
See
sksurv.svm.NaiveSurvivalSVM
for the linear naive survival SVM based on liblinear.\[ \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 \phi(\mathbf{x})_i  \mathbf{w}^\top \phi(\mathbf{x})_j \geq 1  \xi_{ij},\quad \forall (i, j) \in \mathcal{P}, \\ \xi_i \geq 0,\quad \forall (i, j) \in \mathcal{P}.\end{split}\\\mathcal{P} = \{ (i, j) \mid y_i > y_j \land \delta_j = 1 \}_{i,j=1,\dots,n}.\end{aligned}\end{align} \]See [1], [2], [3] for further description.
Parameters:  solver ("cvxpy"  "cvxopt"  "osqp", optional, default: cvxpy) – 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: "all") –
Which constraints to use in the optimization problem.
 all: Use all comparable pairs. Scales quadratic in number of samples.
 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 (cf.
sksurv.svm.MinlipSurvivalSVM
).  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 nonzero 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,)
References
[1] Van Belle, V., Pelckmans, K., Suykens, J. A., & Van Huffel, S. Support Vector Machines for Survival Analysis. In Proc. of the 3rd Int. Conf. on Computational Intelligence in Medicine and Healthcare (CIMED). 18. 2007 [2] Evers, L., Messow, C.M., “Sparse kernel methods for highdimensional survival data”, Bioinformatics 24(14), 16328, 2008. [3] Van Belle, V., Pelckmans, K., Suykens, J.A., Van Huffel, S., “Survival SVM: a practical scalable algorithm”, In: Proc. of 16th European Symposium on Artificial Neural Networks, 8994, 2008. 
__init__
(solver='cvxpy', alpha=1.0, kernel='linear', gamma=None, degree=3, coef0=1, kernel_params=None, pairs='all', verbose=False, timeit=None, max_iter=None)[source]¶ Initialize self. See help(type(self)) for accurate signature.
Methods
__init__
([solver, alpha, kernel, gamma, …])Initialize self. fit
(X, y)Build a MINLIP survival model from training data. predict
(X)Predict risk score of experiencing an event. score
(X, y)Returns the concordance index of the prediction. 
fit
(X, y)[source]¶ Build a MINLIP survival model from training data.
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: Return type: self

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 (arraylike, 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 (arraylike, 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