← Questions
Timed ML screen: concept questions, then classic models from scratch
0
I was asked this
No reports yet. Sign in to say where you were asked it.
A coding interview question asked in Meta's technical phone screen, last asked Dec 2025. It tests machine learning, logistic regression and naive bayes.
A timed online screen for ML-leaning engineers, about ten items in a little over an hour:
- Multiple-choice ML concepts: compute recall from a confusion matrix, compare bagging and boosting, and say what L1 and L2 regularization each do.
- Given the weights of a small two-layer network and an input, compute its output by hand.
- A short string problem: the longest substring made of one repeated character.
- Implement logistic regression and naive Bayes from scratch (fit and predict) without ML libraries.
The questions are not hard on their own; the pressure is getting all of them right in the time.
Clarifying questions
- Which language and libraries are allowed: NumPy yes, scikit-learn no?
- Naive Bayes on which features: Gaussian for continuous values, or counts? Should it use Laplace smoothing?
- Logistic regression: binary only? Gradient descent with a fixed number of steps? Any regularization?
- For the network by hand, which activation functions?
- Is credit given per test case, so a partial answer still scores?
What a strong answer covers
- The concepts stated precisely: recall is true positives over true positives plus false negatives; bagging lowers variance with models trained in parallel on resamples, boosting lowers bias by fitting models in sequence to earlier errors; L1 pushes weights to exactly zero, L2 shrinks them smoothly.
- The forward pass layer by layer: weights times input, plus bias, then the activation, with the shapes checked at each step.
- The longest run of one character in one pass, including the empty string.
- Logistic regression with a vectorized gradient, a numerically stable sigmoid and a bias term; naive Bayes with log-probabilities and smoothing, so an unseen value does not zero out a class.
- Time management: easy items first, and each implementation checked on a tiny dataset before moving on.
Follow-ups
- Extend logistic regression to several classes with softmax.
- Why does naive Bayes work well despite its independence assumption?
- Add L2 regularization to your logistic regression.
Where it's asked
- Meta · Technical phone screen · Last asked Dec 202545 min · Two coding problems in CoderPad, about 20 minutes each · Usually no AI; some newer screens are AI-assisted
What it tests
machine learning · logistic regression · naive bayes · sliding window
No official answer yet. Write yours on the right and run it.
Nothing published yet.
Sign in to submit your code; every attempt is kept here.
Write and test your solution herePython in your browser, the question's tests level by level, every submission kept for you.Sign in to start coding
