traintest {sparselink} | R Documentation |
Train and test model
Description
Trains and tests prediction models
Usage
traintest(
y_train,
X_train,
y_test = NULL,
X_test = NULL,
family = "gaussian",
alpha = 1,
method = c("wrap_empty", "wrap_separate", "sparselink"),
alpha.init = 0.95,
type = "exp",
cands = NULL
)
Arguments
y_train |
target of training samples:
|
X_train |
features of training samples:
|
y_test |
target of testing samples:
|
X_test |
features of testing samples:
|
family |
character |
alpha |
elastic net mixing parameter of final regressions, default: 1 (lasso) |
alpha.init |
elastic net mixing parameter for initial regressions, default: 0.95 (lasso-like elastic net) |
type |
default |
cands |
candidate values for both scaling parameters,
default: |
Value
Returns a list with the computation time in slot time
, the out-of-sample deviance in slot deviance
, the out-of-sample ROC-AUC in slot auc
, the coefficients in slot coef
, the predicted value in slot y_hat
, and the optimal hyperparameters in slot hyperpar
.
Examples
#--- multi-task learning ---
family <- "gaussian"
data <- sim_data_multi(family=family)
result <- traintest(data$y_train,data$X_train,family=family)
#--- transfer learning ---
family <- "gaussian"
data <- sim_data_trans(family=family)
result <- traintest(data$y_train,data$X_train,family=family)