Databricks-ML-Assoc ML Workflows Practice Question
Which technique should be used to prevent data leakage in ML workflows when performing cross-validation on time-series data?
⚠ Common exam trap
Candidates often apply standard k-fold cross-validation to time-series data, failing to realize that random splitting causes look-ahead bias, which invalidates the model's performance metrics.
Answer choices
Why each option matters
Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.
Correct answer & explanation
✓
Expanding window cross-validation (time-series split).
In time-series forecasting, standard k-fold cross-validation is inappropriate because it would allow the model to 'see' the future during training, leading to overly optimistic performance estimates. Instead, 'time-series split' or 'walk-forward' validation should be used, where the training set only consists of data points that occur chronologically before the validation set. This preserves the temporal order, providing a realistic assessment of the model's performance on unseen future data.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
Random sampling with replacement across the entire dataset.
Why it's wrong here
Random sampling ignores the temporal dependencies inherent in time-series data. It would shuffle historical data into the future and vice-versa, which is a textbook example of data leakage. This approach would result in invalid evaluation metrics that do not reflect the actual performance of the forecasting model.
- ✗
Standard k-fold cross-validation with 5 folds.
Why it's wrong here
Standard k-fold cross-validation is designed for independent and identically distributed (i.i.d.) data. When applied to time-series data, it violates the temporal structure by including future data points in the training set for earlier folds, thereby causing severe data leakage and inflating reported model metrics.
- ✓
Expanding window cross-validation (time-series split).
Why this is correct
Expanding window validation maintains the temporal order of the data. By training on a chronologically growing window and testing on the subsequent period, you simulate real-world usage where the model predicts the future based on past data, correctly preventing leakage and ensuring reliable evaluation of the model's accuracy.
- ✗
Removing all features that have high correlation with the target variable.
Why it's wrong here
Removing correlated features is a dimensionality reduction or feature selection technique, not a strategy for cross-validation. While it can reduce overfitting, it does not solve the fundamental issue of data leakage in time-series validation. Correct validation strategy remains the most important step for time-series model evaluation.
About these practice questions
One of 319 original Databricks-ML-Assoc practice questions on Courseiva, each with a full explanation and wrong-answer analysis — not exam dumps or protected exam content. Learn why practice questions differ from exam dumps →
JA
Written and reviewed by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
Last reviewed September 2026 · checked against the official Databricks exam blueprint
This Databricks-ML-Assoc practice question is part of Courseiva's free Databricks certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the Databricks-ML-Assoc exam.