Python 6.3 · 11 min
The Estimator Pattern
Write a tiny model class with `fit` and `predict`, the shape every scikit-learn model has.
The lesson, part by part- The estimator interface: fit and predict
- fit and learned state: a mean predictor
- Learned attributes and the trailing underscore convention
- Hyperparameters: k nearest neighbours
- Changing the hyperparameter k
- Comparing with scikit-learn's KNeighborsRegressor
- Common estimator errors: aliased input data and refitting
- Recap and challenge: the estimator pattern
Key term · fitThe method that learns from examples. It stores what it learned in attributes ending in _, and returns self.
- A 5-question quiz, marked the moment you answer
- Practice at levels A to C, with values to check against
- Where the idea is used in real work
- Common mistakes: the error you will see, why, and the fix
- 2 notebooks to run the examples yourself
- 25 interview questions with model answers