← Amazon Interview Insights

Amazon·Machine Learning Engineer·Technical Phone Screen·Intermediate

Intermediate
Jun 2026

Summary

Interviewed at Amazon for a machine learning role, got a fairly textbook question about dataset splitting. Nothing too wild but it made me realize how much I'd been taking the basics for granted.

Questions Asked (1)

Q1

How would you split a dataset into training, evaluation, and test sets for a machine learning project?

Technical Trade-offsAlgorithms & Data Structures
Author's notes

I answered it fine on the surface but stumbled when they pushed on why you'd need a separate validation set at all versus just using the test set for both.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying the project context (dataset size, class balance, temporal or group structure) and then propose a split strategy that avoids data leakage and ensures representative subsets. Discuss common ratios like 70/15/15 or 80/10/10, and mention advanced techniques such as stratified sampling, time-based splits, or group splits when applicable. Finally, explain how you would validate the split and monitor for distribution shifts.

Pro tip: Emphasize that the test set should be locked away until final evaluation and that any preprocessing (e.g., scaling, imputation) must be fit only on the training set to prevent leakage. Also, mention that for large datasets, a smaller test set (e.g., 1-2%) may suffice if it's statistically representative.

1. Clarify project requirements and data characteristics

Ask about dataset size, feature types, class balance, and whether data has temporal or group dependencies. This determines the appropriate splitting method.

2. Choose a splitting strategy

Select a method such as random split, stratified split, time-based split, or group split based on the data characteristics. For imbalanced data, use stratified sampling to preserve class ratios.

3. Determine split ratios

Decide on proportions for training, validation, and test sets. Common ratios are 70/15/15 or 80/10/10, but adjust based on dataset size and model complexity.

4. Implement the split and avoid leakage

Perform the split before any preprocessing. Ensure that any transformations (e.g., normalization, feature engineering) are fit only on the training set and applied to validation and test sets.

5. Validate and monitor the split

Check that the distributions of key features and target are similar across splits. For production, consider setting up a holdout test set that is only used once, and monitor for data drift over time.

Key Points to Mention

  • Data leakage: avoid using test data during training or preprocessing.
  • Stratified sampling for imbalanced classification tasks.
  • Time-based splitting for temporal data to prevent lookahead bias.
  • Group splitting to keep related samples (e.g., same user) in one set.
  • Typical split ratios (e.g., 70/15/15) and when to adjust them.
  • The importance of a final untouched test set for unbiased evaluation.

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.