Bayesian Optimization for the Cox–KL Integration Parameter (eta)
bopt.coxkl.RdEmploys Bayesian Optimization to find the optimal integration parameter eta
for the Cox–KL model by maximizing a cross-validated performance criterion.
The function wraps cv.coxkl and uses the rBayesianOptimization
framework to efficiently search the parameter space.
Usage
bopt.coxkl(
z,
delta,
time,
stratum = NULL,
RS = NULL,
beta = NULL,
criteria = c("V&VH", "LinPred", "CIndex_pooled", "CIndex_foldaverage"),
bounds_list = list(eta = c(0, 10)),
init_grid_dt = data.frame(eta = c(0, 1, 5)),
init_points = 0,
n_iter = 10,
acq = "ucb",
kappa = 2.576,
seed = NULL,
verbose = TRUE,
...
)Arguments
- z
Numeric matrix of covariates.
- delta
Numeric vector of event indicators (1 = event, 0 = censored).
- time
Numeric vector of observed event or censoring times.
- stratum
Optional numeric or factor vector defining strata.
- RS
Optional numeric vector or matrix of external risk scores.
- beta
Optional numeric vector of external coefficients.
- criteria
Character string specifying the performance criterion. Choices are
"V&VH","LinPred","CIndex_pooled", or"CIndex_foldaverage".- bounds_list
A named list defining the search range for
eta, e.g.,list(eta = c(0, 10)).- init_grid_dt
A
data.frameof initial points for the optimization. Default is0ifinit_grid_dtis provided.- n_iter
Number of iterations for the Bayesian Optimization process.
- acq
Acquisition function type. Default is
"ucb".- seed
Optional integer seed to ensure reproducible CV fold assignments.
- verbose
Logical; if
TRUE, progress of the optimization is printed.- ...
Value
A list containing:
best_etaThe optimal
etavalue discovered.best_betaThe coefficient vector corresponding to
best_eta.best_scoreThe raw performance metric value at
best_eta.full_statsA
data.frameof all evaluatedetavalues and their scores, sorted byeta.beta_matrixA matrix where each column corresponds to the fitted
betafor eachetainfull_stats.bo_objectThe raw object returned by
BayesianOptimization.criteriaThe criterion used for optimization.
Examples
if (FALSE) { # \dontrun{
data(ExampleData_lowdim)
train_dat <- ExampleData_lowdim$train
beta_ext <- ExampleData_lowdim$beta_external_fair
opt_res <- bopt.coxkl(
z = train_dat$z,
delta = train_dat$status,
time = train_dat$time,
stratum = train_dat$stratum,
beta = beta_ext,
criteria = "CIndex_pooled",
bounds_list = list(eta = c(0, 10)),
init_grid_dt = data.frame(eta = c(0, 1, 5)),
n_iter = 20,
nfolds = 5,
seed = 2024
)
} # }