KatInterview

Five ML Fundamentals: Regression, Forests, Adam, Network Width

Machine LearningModel answer
HardModel answerMachine Learninglinear-regressionlogistic-regressionrandom-forest

Last updated

Answer five conceptual machine learning questions on regression assumptions, logistic loss, random forest feature sampling, Adam versus SGD, and narrow versus wide networks.

Imagine a technical screen for an applied ML role. You are asked to explain five fundamentals out loud. For each, give a precise answer and justify the reasoning behind it, since follow-up questions will target any hand-waving. Assume standard supervised learning unless stated otherwise. No code is required; light math notation is welcome.

Part 1: Linear regression. Which assumptions underlie linear regression? Which of them are needed for the coefficient estimates to be unbiased or consistent, and which only for trustworthy standard errors, confidence intervals and tests? Why is squared loss the usual choice, and what statistic of the target does its minimizer estimate?

Part 2: Logistic regression. What does logistic regression model? A logarithm shows up in more than one place in its formulation. Identify each place and explain why it is there, including the practical advantages of the log in the training objective.

Part 3: Random forest. What is a random forest and how does it produce a prediction? How is the pool of candidate features chosen at each split, and why does that restriction help generalization?

Part 4: Adam versus SGD. Describe how Adam works, including its per-parameter state, bias correction and update rule. Give at least two strengths and two weaknesses compared with plain SGD, including how it interacts with weight decay.

Part 5: Narrow versus wide networks. Two networks share the same two-layer design, but one has few units per layer and the other has many. Which is more likely to end up stuck in a poor local minimum, and why? What risk comes with the other one, and how would you mitigate it?

Hints

Hint 1

For Part 1, separate what you need for the estimator to be unbiased (linearity in parameters, exogeneity, no perfect collinearity) from what you need for valid inference (homoscedasticity, uncorrelated errors, often normality).

Hint 2

For Part 2, one log is the log-odds (logit) link in the model, and the other is the log-likelihood in the loss. Think about products of probabilities, numerical stability and convexity.

Hint 3

For Parts 3 to 5, tie each answer to a mechanism: variance of an average of correlated predictors, first and second moment estimates with their zero-initialization bias, and the way extra width creates many good directions in the loss landscape.