Validation and hyperparameter tuning
Design evaluation splits that reflect the real prediction setting.
Select tuning settings on validation data, then reserve test data for final evaluation.
Interview questions
Choose a question to reveal its answer.
01EasyCoreWhen is a single train-validation-test split sufficient?
Answer
When is a single train-validation-test split sufficient?
It can be appropriate with enough independent representative data; small samples or unstable estimates may benefit from repeated validation.
Separate a large labeled dataset into disjoint partitions.
02EasyCoreVisualHow does k-fold cross-validation work?
Answer
How does k-fold cross-validation work?
Divide data into k folds; train on k minus one and evaluate on the held-out fold in turn.
Run five validation fits on a modest independent dataset.
03MediumCoreWhy use stratified K-fold in imbalanced classification?
Answer
Why use stratified K-fold in imbalanced classification?
It approximately preserves class frequencies in folds, reducing folds with few minority examples where feasible.
Ensure rare fraud cases appear across validation folds.
04MediumCoreWhen is group-based cross-validation necessary?
Answer
When is group-based cross-validation necessary?
Use it when observations are dependent within groups and the intended evaluation involves unseen groups.
Hold out complete patients, users or organizations.
05MediumHigh priorityWhy should time-series validation respect chronological order?
Answer
Why should time-series validation respect chronological order?
Training on future observations can leak information unavailable at the prediction time.
Train on earlier months and evaluate on subsequent months.
from sklearn.model_selection import TimeSeriesSplit
X = list(range(8))
for train, test in TimeSeriesSplit(n_splits=3).split(X):
print(train, test)Each split trains on earlier observations and evaluates later observations.
06EasyHigh priorityHow does grid search tune hyperparameters?
Answer
How does grid search tune hyperparameters?
It evaluates a predefined set of hyperparameter combinations using an evaluation procedure.
Compare several tree depths and minimum leaf sizes.
07MediumHigh priorityWhy can random search outperform grid search under a fixed budget?
Answer
Why can random search outperform grid search under a fixed budget?
It can explore more distinct values of influential dimensions when only some hyperparameters matter strongly.
Sample learning rates and regularization strengths from suitable distributions.
08HardHow does nested cross-validation avoid optimistic tuning estimates?
Answer
How does nested cross-validation avoid optimistic tuning estimates?
The inner loop selects settings and the outer loop evaluates the resulting selection procedure on untouched outer folds.
Compare hyperparameter-tuned models without evaluating tuning on outer labels.
09MediumWhy should a decision threshold be selected on validation data?
Answer
Why should a decision threshold be selected on validation data?
Choosing it on final test outcomes contaminates the final estimate; use validation data and a defined error-cost objective.
Pick a threshold that balances false positives and false negatives.
10HardHow would you report uncertainty in model performance?
Answer
How would you report uncertainty in model performance?
Use an appropriate uncertainty method that respects dependencies and sampling design, such as paired bootstrap for independent cases.
Report an interval for the difference in accuracy on shared test examples.
Priority and difficulty are editorial study recommendations.
Technical reference: Documentation / paper ↗
Try a few practice questions
Explore the questions before creating a free account.