Train models from given engines

train_models(data, y, engine, type)

Arguments

data

A training data for models created by `prepare_data()` function.

y

A string that indicates a target column name.

engine

A vector of tree-based models that shall be created. Possible values are: `ranger`, `xgboost`,`decision_tree`, `lightgbm`, `catboost`.

type

A string that determines if Machine Learning task is the `binary_clf` or `regression`.

Value

A list of models for every engine.

Examples

data(iris)
iris_bin          <- iris[1:100, ]
type              <- guess_type(iris_bin, 'Species')
preprocessed_data <- preprocessing(iris_bin, 'Species', type)
#> Error in if (advanced) {    del_cor <- delete_correlated_values(pre_data, y, verbose = verbose)    pre_data <- del_cor$data    pre_data <- delete_id_columns(pre_data)    pre_data <- boruta_selection(pre_data, y)}: argument is not interpretable as logical
preprocessed_data <- preprocessed_data$data
#> Error in eval(expr, envir, enclos): object 'preprocessed_data' not found
split_data <-
  train_test_balance(preprocessed_data, 'Species', balance = FALSE)
#> Error in train_test_balance(preprocessed_data, "Species", balance = FALSE): object 'preprocessed_data' not found
train_data <-
  prepare_data(split_data$train,
               'Species',
               c('ranger', 'xgboost', 'decision_tree', 'lightgbm', 'catboost'))
#> Error in as.data.frame(unclass(data), stringsAsFactors = TRUE): object 'split_data' not found
model <-
  train_models(train_data,
               'Species',
               c('ranger', 'xgboost', 'decision_tree', 'lightgbm', 'catboost'),
               type)
#> Error in ranger::ranger(dependent.variable.name = y, data = data$ranger_data,     classification = TRUE, probability = TRUE): object 'train_data' not found