The survival SVM model using hybrid approach requires gamma.mu to be a vector as below. How can we tune gamma.mu in this case?
lrn("surv.svm", type = "hybrid", diff.meth = "makediff3", gamma.mu=c(0.1, 0.1))
The survival SVM model using hybrid approach requires gamma.mu to be a vector as below. How can we tune gamma.mu in this case?
lrn("surv.svm", type = "hybrid", diff.meth = "makediff3", gamma.mu=c(0.1, 0.1))
You need to tune parts of the vector separately then combine in a transformation. You might find this tutorial helpful. Example below
library(mlr3)
library(mlr3proba)
library(mlr3tuning)
library(mlr3extralearners)
t = tgen("simsurv")$generate(5)
search_space = ps(
gamma = p_dbl(1e-3, 1e3),
mu = p_dbl(1e-3, 1e3)
)
search_space$trafo = function(x, param_set) {
x$gamma.mu = c(x$gamma, x$mu)
x$gamma = x$mu = NULL
x
}
AutoTuner$new(
lrn("surv.svm", type = "hybrid", diff.meth = "makediff3",
gamma.mu = c(0.1, 0.1)),
rsmp("holdout"),
msr("surv.cindex"),
trm("evals", n_evals = 3),
tnr("grid_search", resolution = 2),
search_space
)$train(t)$predict(t)
#> INFO [21:40:21.261] [bbotk] Starting to optimize 2 parameter(s) with '<OptimizerGridSearch>' and '<TerminatorEvals> [n_evals=3]'
#> INFO [21:40:21.275] [bbotk] Evaluating 1 configuration(s)
#> INFO [21:40:21.294] [mlr3] Running benchmark with 1 resampling iterations
#> INFO [21:40:21.315] [mlr3] Applying learner 'surv.svm' on task 'simsurv'
#> INFO [21:40:21.425] [bbotk] Finished optimizing after 3 evaluation(s)
#> INFO [21:40:21.425] [bbotk] Result:
#> INFO [21:40:21.426] [bbotk] gamma mu learner_param_vals x_domain surv.cindex
#> INFO [21:40:21.426] [bbotk] 0.001 1000 <list[3]> <list[1]> 1
#> <PredictionSurv> for 5 observations:
#> row_ids time status crank response
#> 1 5.000000 FALSE -22.915171 22.915171
#> 2 5.000000 FALSE -1.442179 1.442179
#> 3 3.640326 TRUE 3.849970 -3.849970
#> 4 0.268220 TRUE 4.269720 -4.269720
#> 5 5.000000 FALSE -2.670886 2.670886
Created on 2022-02-19 by the reprex package (v2.0.1)