Machine Learning Model Tuning in R
Instruction: Explain the process of tuning hyperparameters for a machine learning model in R, including the use of caret or tidymodels.
Context: This question tests the candidate's ability to optimize machine learning models in R, a key competency for developing accurate predictive models.
Updated
Official answer available
Read the opening below, then unlock the full answer and practical guidance.
Reserve the final assessment data, choose a metric and resampling scheme that match deployment, then tune only within the training portion. Hyperparameters are settings chosen outside an individual fit; their best observed value is conditional on the data, search space and validation design.
With tidymodels, define a parsnip model with selected arguments marked tune(), choose an engine/mode, and combine it with a formula or recipe in a workflow...