← Coinbase Interview Insights

Coinbase·Machine Learning Engineer·Technical Phone Screen·Senior

Senior
Apr 2026

Summary

Coinbase ML engineer interview with a coding question focused on implementing a bagging classifier from scratch. Pretty straightforward if you know ensemble methods, but the details around bootstrap sampling and aggregation can trip you up if you're fuzzy on the mechanics.

Questions Asked (1)

Q1

Implement a bagging (bootstrap aggregating) classifier. A base classifier is provided. Given training data X and labels y, train multiple base classifiers each on a bootstrap sample of the data, then aggregate predictions on new inputs via majority vote. You need to implement fit(X, y) and predict(X).

Algorithms & Data StructuresTechnical Trade-offsSystem Design
Author's notes

The core idea isn't hard but I spent too long second-guessing the bootstrap sampling part.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying the problem and assumptions, then outline the bagging algorithm: generate bootstrap samples, train base classifiers, and aggregate predictions via majority vote. Implement fit and predict methods, and discuss trade-offs like computational cost and variance reduction.

Pro tip: Mention that bagging reduces variance without increasing bias, making it effective for high-variance models like decision trees, and highlight that it's embarrassingly parallel, which is crucial for scalability at a company like Coinbase.

1. Clarify requirements and assumptions

Ask about the base classifier interface, data size, and whether bootstrap sampling should be with replacement. Confirm that majority vote is for classification and handle ties if necessary.

2. Design the bagging algorithm

Decide on the number of estimators (e.g., 10-100). For each estimator, create a bootstrap sample by sampling with replacement from the training data, then train the base classifier on that sample.

3. Implement fit method

In fit(X, y), loop over the number of estimators, generate bootstrap indices, extract the corresponding X and y, and train a clone of the base classifier. Store the trained models in a list.

4. Implement predict method

In predict(X), collect predictions from each base classifier, then perform majority vote (e.g., using mode) to return the final prediction for each input.

5. Discuss trade-offs and optimizations

Mention that bagging increases training time linearly with the number of estimators but can be parallelized. Also note that it reduces variance and helps with overfitting, but may not help with high-bias models.

Key Points to Mention

  • Bootstrap sampling: sampling with replacement to create diverse training sets.
  • Majority voting: aggregating predictions by taking the most common class (mode).
  • Variance reduction: bagging decreases variance without increasing bias, improving stability.
  • Parallelization: base classifiers can be trained independently, enabling distributed computing.
  • Base classifier choice: works best with high-variance, low-bias models like decision trees.
  • Handling ties: in case of a tie in majority vote, decide on a strategy (e.g., random choice or fallback to a default class).

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