This method returns the vector of coefficients coef_ estimated by
sksurv.svm.FastKernelSurvivalSVM. Each coefficient corresponds to
the weight assigned to an individual training sample in the kernel-induced
decision function.
# S3 method for class 'fastsvm'
coef(object, ...)An object of class "fastsvm" returned by
fastsvm().
Additional arguments (unused; included for S3 compatibility).
A numeric vector of length n, containing the sample-wise
coefficients alpha_i.
These coefficients play the same role as support vector weights in classical SVMs: samples with non-zero coefficients (within a tolerance) can be interpreted as "support-like" vectors.
if (reticulate::py_module_available("sksurv")) {
set.seed(1)
df <- data.frame(
time = rexp(50, 0.1),
status = rbinom(50, 1, 0.7),
x1 = rnorm(50),
x2 = rnorm(50)
)
fit <- fastsvm(
data = df,
time_col = "time",
delta_col = "status",
kernel = "rbf"
)
coef(fit) # extract coefficients
}
#> [1] 0.0988295961 0.4422183429 -1.0353944024 -1.1098006049 -0.5907513543
#> [6] 0.8615189452 0.0539512236 -0.0170511234 -0.1578927880 0.1414406404
#> [11] 0.8255864355 -0.6236493601 -0.0141246166 0.6135334151 0.4224469982
#> [16] 0.3168272488 0.9634028793 0.0179499190 -0.6155998980 -0.4296408160
#> [21] -0.0104739418 -0.4608897297 -0.0063722096 -0.2752767057 -0.0001050367
#> [26] -0.2877782376 -0.1199150237 1.7557245803 0.5064472466 0.2584233655
#> [31] 0.5828133749 -2.5250416285 -0.8311400948 0.2060033536 0.0277469958
#> [36] 0.1474868548 -0.6195151722 0.0968070294 0.1119993120 -1.0833248600
#> [41] 0.3543806259 0.2276233928 0.6607779454 -0.0230249575 -0.3111701407
#> [46] -0.4550764591 0.1855536724 0.3717992077 0.2123928470 1.1392685006