MLS-C01 Question 196
Select 3You are training a machine learning model using Amazon SageMaker and want to ensure that the model generalizes well to unseen data. To achieve this, you decide to use k-fold cross-validation. Which of the following statements are true about k-fold cross-validation in this context?
- A
The dataset is divided into k equally-sized folds, and the model is trained on k-1 folds while tested on the remaining fold.
- B
Cross-validation helps identify overfitting by testing the model on data it has not seen during training.
- C
In k-fold cross-validation, the validation fold remains fixed throughout the k iterations.
- D
Using cross-validation can increase training time since the model is trained multiple times.
- E
k-fold cross-validation can be automatically performed using SageMaker's built-in algorithms without additional scripting.
Show answer and explanation
Correct answers: A, B, D
Explanation
K-fold cross-validation is a robust method for evaluating a model's performance on unseen data. By splitting the dataset into k folds and iteratively using a fold for validation while training on the remaining folds, this technique provides a thorough assessment of the model's ability to generalize. It helps identify overfitting and underfitting issues but increases computational overhead as the model is trained multiple times. SageMaker does not natively automate k-fold cross-validation, requiring custom implementation for this functionality.
- A. Correct.
This statement is correct. In k-fold cross-validation, the dataset is split into k folds, and each fold serves as a validation set at least once while the others are used for training.
- B. Correct.
This statement is correct. Cross-validation provides a way to measure model performance on unseen data, helping detect overfitting or underfitting.
- C. Incorrect.
This statement is incorrect. The validation fold changes in every iteration of k-fold cross-validation to ensure all data points are used for both training and validation across k iterations.
- D. Correct.
This statement is correct. Since the model is trained k times (once for each fold), cross-validation increases the overall training time.
- E. Incorrect.
This statement is incorrect. While SageMaker provides functionality for splitting data into training and validation sets, k-fold cross-validation typically requires custom scripting or manual implementation in SageMaker.