Everything else is ready: study the parts, the key terms and the quiz below.
The Estimator Pattern
Write a tiny model class with `fit` and `predict`, the shape every scikit-learn model has.
In this lesson8 parts
- 01The shape every model has
- 02fit stores what the model learns
- 03The trailing underscore
- 04A model with a setting
- 05Changing k
- 06The same numbers as scikit-learn
- 07Where estimators mislead
- 08Recap, your challenge, and the module
Key terms
The words this lesson introduces, each in one line. The module’s glossary collects them all.
- estimator
- An object that learns from data in
fitand answers inpredict. Every scikit-learn model is one. - fit
- The method that learns from examples. It stores what it learned in attributes ending in
_, and returnsself. - hyperparameter
- A setting of a model chosen before training, not learned in
fit:kinKNNRegressor(k=2). - predict
- The method that gives answers for new inputs, using what
fitlearned.
Quiz 5 questions
Your first pick on each question is the one that counts, and a right one earns a coin. Getting one wrong here is how the lesson sticks.
Practice
Problems to solve in your own notebook. Each states the problem, not the steps: working out the steps is the exercise. Level A applies the lesson, B combines it with earlier ones, C stretches it.
The self-checking notebook for this lesson is Notebook 2 · The Estimator Pattern.
Common mistakes
What you will see when it goes wrong, why it happens, and the fix.
Where it’s used
Where this lesson’s ideas turn up in real work.