← Coinbase Interview Insights

Coinbase·Machine Learning Engineer·Technical Phone Screen·Senior

Senior
May 2026

Summary

Coinbase ML engineer interview with a coding question focused on implementing a bagging classifier from scratch. Pretty standard ML fundamentals round but it required you to actually write working code, not just talk through the concept.

Questions Asked (1)

Q1

Implement a bagging (bootstrap aggregating) classifier. You're given a base classifier class. Write fit(X, y) to train multiple base classifiers on bootstrap samples of the training data, and predict(X) to aggregate predictions via majority vote.

Algorithms & Data StructuresTechnical Trade-offs
Author's notes

The core logic isn't that hard once you break it down.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying the interface and assumptions: base classifier must support fit and predict, and we need to store multiple classifiers. Then implement fit by generating bootstrap samples (sampling with replacement) and training a clone of the base classifier on each. For predict, collect predictions from all classifiers and return the majority vote (mode) for each sample.

Pro tip: Mention that you would use a fresh clone of the base classifier for each bootstrap sample to avoid overwriting, and that you can optionally use parallelization (e.g., joblib) for efficiency. Also, note that ties in majority vote can be broken by a predefined rule (e.g., lowest class label).

1. Clarify requirements and assumptions

Confirm that the base classifier has fit and predict methods, and that we need to store n_estimators classifiers. Ask about tie-breaking and whether probabilities are needed.

2. Implement fit method

For each of n_estimators: generate a bootstrap sample by sampling indices with replacement from the training data, clone the base classifier, fit it on the sample, and store the trained classifier.

3. Implement predict method

For each classifier, get predictions on X. Then for each sample, aggregate predictions via majority vote (e.g., using scipy.stats.mode or a custom counter) and return the array of predicted labels.

4. Handle edge cases and optimizations

Discuss tie-breaking, parallel training, memory considerations, and potential use of out-of-bag samples for validation.

Key Points to Mention

  • Bootstrap sampling: sampling with replacement to create diverse training sets.
  • Cloning the base classifier to avoid shared state between estimators.
  • Majority voting aggregation for classification (mode of predictions).
  • Tie-breaking strategy in case of equal votes.
  • Parallelization for training and prediction to improve efficiency.
  • Out-of-bag error estimation as a bonus for validation.

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