sksurv.svm.FastKernelSurvivalSVM#
- class sksurv.svm.FastKernelSurvivalSVM(alpha=1, rank_ratio=1.0, fit_intercept=False, kernel='rbf', gamma=None, degree=3, coef0=1, kernel_params=None, max_iter=20, verbose=False, tol=None, optimizer=None, random_state=None, timeit=False)[source]#
Efficient Training of kernel Survival Support Vector Machine.
See the User Guide and 1 for further description.
- Parameters
alpha (float, positive, default: 1) – Weight of penalizing the squared hinge loss in the objective function
rank_ratio (float, optional, default: 1.0) – Mixing parameter between regression and ranking objective with
0 <= rank_ratio <= 1
. Ifrank_ratio = 1
, only ranking is performed, ifrank_ratio = 0
, only regression is performed. A non-zero value is only allowed if optimizer is one of ‘avltree’, ‘PRSVM’, or ‘rbtree’.fit_intercept (boolean, optional, default: False) – Whether to calculate an intercept for the regression model. If set to
False
, no intercept will be calculated. Has no effect ifrank_ratio = 1
, i.e., only ranking is performed.kernel ("linear" | "poly" | "rbf" | "sigmoid" | "cosine" | "precomputed") – Kernel. Default: “linear”
degree (int, default: 3) – Degree for poly kernels. Ignored by other kernels.
gamma (float, optional) – Kernel coefficient for rbf and poly kernels. Default:
1/n_features
. 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
max_iter (int, optional, default: 20) – Maximum number of iterations to perform in Newton optimization
verbose (bool, optional, default: False) – Whether to print messages during optimization
tol (float, optional) – Tolerance for termination. For detailed control, use solver-specific options.
optimizer ("avltree" | "rbtree", optional, default: "rbtree") – Which optimizer to use.
random_state (int or
numpy.random.RandomState
instance, optional) – Random number generator (used to resolve ties in survival times).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
optimizer_result_
attribute.
- coef_#
Weights assigned to the samples in training data to represent the decision function in kernel space.
- Type
ndarray, shape = (n_samples,)
- fit_X_#
Training data.
- Type
ndarray
- optimizer_result_#
Stats returned by the optimizer. See
scipy.optimize.optimize.OptimizeResult
.- Type
scipy.optimize.optimize.OptimizeResult
- 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_,)
See also
FastSurvivalSVM
Fast implementation for linear kernel.
References
- 1
Pölsterl, S., Navab, N., and Katouzian, A., An Efficient Training Algorithm for Kernel Survival Support Vector Machines 4th Workshop on Machine Learning in Life Sciences, 23 September 2016, Riva del Garda, Italy. arXiv:1611.07054
- __init__(alpha=1, rank_ratio=1.0, fit_intercept=False, kernel='rbf', gamma=None, degree=3, coef0=1, kernel_params=None, max_iter=20, verbose=False, tol=None, optimizer=None, random_state=None, timeit=False)[source]#
Methods
__init__
([alpha, rank_ratio, fit_intercept, ...])fit
(X, y)Build a survival support vector machine model from training data.
get_params
([deep])Get parameters for this estimator.
predict
(X)Rank samples according to survival times
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 survival support vector machine 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]#
Rank samples according to survival times
Lower ranks indicate shorter survival, higher ranks longer survival.
- Parameters
X (array-like, shape = (n_samples, n_features)) – The input samples.
- Returns
y – Predicted ranks.
- 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