Specify predictors, outcome, and metadata by building a recipe.
buildRecipe(train_data, use_pca = FALSE, pca_threshold = 0.95)The part of the feature data designated for ML model
training. This can be the output of
rsample::training(splitMLInputTibble(ml_input_tibble)).
bool Set to TRUE to use PCA instead of all features.
num The proportion of total variance for which the principle components account
A recipe object
train <- tibble::tibble(
genome_id = paste0("g", 1:10),
genome_drug.resistant_phenotype = rep(c("Resistant", "Susceptible"), each = 5),
feat_a = rep(c(0L, 1L), 5),
feat_b = rep(c(1L, 0L), 5)
)
buildRecipe(train, use_pca = FALSE)
#>
#> ── Recipe ──────────────────────────────────────────────────────────────────────
#>
#> ── Inputs
#> Number of variables by role
#> outcome: 1
#> predictor: 2
#> metadata: 1
#>
#> ── Operations
#> • Zero variance filter on: recipes::all_predictors()
#> • Centering and scaling for: recipes::all_predictors()