“Implement linear regression from scratch” is one of the most common live coding prompts in a quant interview, and it generalizes: logistic regression, k-means, and a decision tree split are all fair game. The interviewer is not testing whether you have memorized scikit-learn. They want to see that you understand the model well enough to turn its math into a dozen lines of clean NumPy, and that you can reason about convergence, edge cases, and cost while you do it.
This lesson builds five models in plain NumPy: linear regression two ways (the closed-form normal equation and gradient descent), logistic regression, k-means clustering, and a decision stump. We lean on the theory from earlier modules rather than re-deriving it, so each section links back to the lesson that explains why the math is what it is. The goal is code you could reproduce on a whiteboard or in a shared editor without notes.
Table of Contents
Already have an account? Log in!