Offline-ready notes · progress saves on this device
Project LibraryStudy workspace →
Courses/Machine Learning/Lesson 3

Lesson 3 of 6

Polynomial Regression & Model Tuning

Read the overview in
English overview

Compare linear and polynomial models with mean squared error, add complexity only when it improves unseen predictions, and diagnose underfitting and overfitting.

7:33 lectureIntermediate11 video chapters30 flashcards + 30 questions
Official Binary Tree uploadML with Python Lectures Week 3Published 2026-08-02 · embedded with chapters, checkpoints, deep notes, and a project

Four clear stages

Learn → Project → Check → Finish

Watch and work through the lecture
  1. 1LearnWatch and work through the lectureUse the chapter notebook and answer each video checkpoint.Do this now
  2. 2ProjectWrite a model-selection memoPlan it, create it, then prove it meets the definition of done.Next
  3. 3CheckAnswer all 30 questionsCorrect weak spots using the explanation after each answer.Next
  4. 4FinishMark the lesson completeThen move to Logistic Regression & Classification.Next
Course outlineMachine Learning with Python

Interactive lecture

Watch, pause, think, apply.

Recognize underfitting and overfitting, compare polynomial complexity on validation data, and select a model for generalization rather than memorization.

0:003 thinking points marked7:33

Numbered markers show where the video will pause. Seeking past one opens the first unanswered check.

Connecting to the lecture…Open on YouTube ↗

Chapter-by-chapter lecture notebook

Everything in the video, organized for learning

The lecture uses polynomial degree to make model complexity visible. The central goal is generalization on new data.

Source reviewed7:33 lectureReviewed against the public lecture with timestamped slide sampling across the full runtime and cross-checked against the source lesson context.
11

video chapters mapped into notes, examples, and a concrete action.

This is a detailed learning companion reconstructed from the reviewed lecture—not a verbatim transcript.
01
0:00 in the lectureLinear-regression recap
What the video is teaching

A linear model establishes a transparent starting point. When residuals show curvature or systematic structure, a richer form may be justified.

Compare models under the same split and metric rather than choosing complexity from visual appeal alone.

What to noticeWorked example

A straight line gives MSE 7.54 and leaves a curved residual pattern, motivating a quadratic candidate.

Do this before continuing

Sketch residuals for one underfit example and write the evidence that complexity is needed.

Replay this chapter on YouTube ↗
02
0:40 in the lectureTrain and test roles
What the video is teaching

A linear model establishes a transparent starting point. When residuals show curvature or systematic structure, a richer form may be justified.

Compare models under the same split and metric rather than choosing complexity from visual appeal alone.

What to noticeWorked example

A straight line gives MSE 7.54 and leaves a curved residual pattern, motivating a quadratic candidate.

Do this before continuing

Sketch residuals for one underfit example and write the evidence that complexity is needed.

Replay this chapter on YouTube ↗
03
1:20 in the lectureA curved pattern
What the video is teaching

A linear model establishes a transparent starting point. When residuals show curvature or systematic structure, a richer form may be justified.

Compare models under the same split and metric rather than choosing complexity from visual appeal alone.

What to noticeWorked example

A straight line gives MSE 7.54 and leaves a curved residual pattern, motivating a quadratic candidate.

Do this before continuing

Sketch residuals for one underfit example and write the evidence that complexity is needed.

Replay this chapter on YouTube ↗
04
2:00 in the lectureMSE reveals poor fit
What the video is teaching

A linear model establishes a transparent starting point. When residuals show curvature or systematic structure, a richer form may be justified.

Compare models under the same split and metric rather than choosing complexity from visual appeal alone.

What to noticeWorked example

A straight line gives MSE 7.54 and leaves a curved residual pattern, motivating a quadratic candidate.

Do this before continuing

Sketch residuals for one underfit example and write the evidence that complexity is needed.

Replay this chapter on YouTube ↗
05
2:35 in the lectureQuadratic regression
What the video is teaching

Polynomial regression adds powers such as x² and x³ while remaining linear in fitted coefficients. Higher degree increases flexibility and sensitivity.

Generate polynomial features inside the training workflow and apply the same transformation to validation and test data.

What to noticeWorked example

A quadratic can capture one bend; a very high degree can weave through every training point and amplify noise.

Do this before continuing

Compare degree 1, 2, and 8 models and predict their bias and variance.

Replay this chapter on YouTube ↗
06
3:15 in the lectureHigher-degree polynomial regression
What the video is teaching

Polynomial regression adds powers such as x² and x³ while remaining linear in fitted coefficients. Higher degree increases flexibility and sensitivity.

Generate polynomial features inside the training workflow and apply the same transformation to validation and test data.

What to noticeWorked example

A quadratic can capture one bend; a very high degree can weave through every training point and amplify noise.

Do this before continuing

Compare degree 1, 2, and 8 models and predict their bias and variance.

Replay this chapter on YouTube ↗
07
3:55 in the lectureHow to test a model
What the video is teaching

Polynomial regression adds powers such as x² and x³ while remaining linear in fitted coefficients. Higher degree increases flexibility and sensitivity.

Generate polynomial features inside the training workflow and apply the same transformation to validation and test data.

What to noticeWorked example

A quadratic can capture one bend; a very high degree can weave through every training point and amplify noise.

Do this before continuing

Compare degree 1, 2, and 8 models and predict their bias and variance.

Replay this chapter on YouTube ↗
08
4:35 in the lectureUnderfit, well-tuned, and overfit
What the video is teaching

Underfitting shows high error because the model is too simple. Overfitting shows excellent training fit but poorer unseen performance because the model learned noise.

Plot training and validation error against complexity and choose the simplest model near the best reliable validation score.

What to noticeWorked example

Degree 2 improves both training and validation; degree 10 reaches zero training error but worse validation error.

Do this before continuing

Label the underfit, useful, and overfit regions on an error-versus-complexity graph.

Replay this chapter on YouTube ↗
09
5:15 in the lectureTraining versus testing error
What the video is teaching

Repeatedly checking the test set turns it into validation data and makes the final score optimistic. Use training for fitting, validation for choices, and test for the final estimate.

Record the candidate set and selection rule before seeing final test performance.

What to noticeWorked example

After choosing degree 2 from validation, the team fits its final procedure and evaluates the untouched test once.

Do this before continuing

Write a split, candidate list, metric, selection rule, and final-test protocol.

Replay this chapter on YouTube ↗
10
6:05 in the lectureGeneralization
What the video is teaching

Repeatedly checking the test set turns it into validation data and makes the final score optimistic. Use training for fitting, validation for choices, and test for the final estimate.

Record the candidate set and selection rule before seeing final test performance.

What to noticeWorked example

After choosing degree 2 from validation, the team fits its final procedure and evaluates the untouched test once.

Do this before continuing

Write a split, candidate list, metric, selection rule, and final-test protocol.

Replay this chapter on YouTube ↗
11
6:50 in the lecturePython regression example
What the video is teaching

Repeatedly checking the test set turns it into validation data and makes the final score optimistic. Use training for fitting, validation for choices, and test for the final estimate.

Record the candidate set and selection rule before seeing final test performance.

What to noticeWorked example

After choosing degree 2 from validation, the team fits its final procedure and evaluates the untouched test once.

Do this before continuing

Write a split, candidate list, metric, selection rule, and final-test protocol.

Replay this chapter on YouTube ↗

Deep explanations

The ideas behind each chapter

Use these sections when the video moves quickly or you need another example.

010:00

Use a simple model as a baseline

A linear model establishes a transparent starting point. When residuals show curvature or systematic structure, a richer form may be justified.

Compare models under the same split and metric rather than choosing complexity from visual appeal alone.

Worked example

A straight line gives MSE 7.54 and leaves a curved residual pattern, motivating a quadratic candidate.

Try it now

Sketch residuals for one underfit example and write the evidence that complexity is needed.

022:35

Understand polynomial features

Polynomial regression adds powers such as x² and x³ while remaining linear in fitted coefficients. Higher degree increases flexibility and sensitivity.

Generate polynomial features inside the training workflow and apply the same transformation to validation and test data.

Worked example

A quadratic can capture one bend; a very high degree can weave through every training point and amplify noise.

Try it now

Compare degree 1, 2, and 8 models and predict their bias and variance.

034:35

Diagnose bias and variance

Underfitting shows high error because the model is too simple. Overfitting shows excellent training fit but poorer unseen performance because the model learned noise.

Plot training and validation error against complexity and choose the simplest model near the best reliable validation score.

Worked example

Degree 2 improves both training and validation; degree 10 reaches zero training error but worse validation error.

Try it now

Label the underfit, useful, and overfit regions on an error-versus-complexity graph.

045:15

Protect the final test from tuning

Repeatedly checking the test set turns it into validation data and makes the final score optimistic. Use training for fitting, validation for choices, and test for the final estimate.

Record the candidate set and selection rule before seeing final test performance.

Worked example

After choosing degree 2 from validation, the team fits its final procedure and evaluates the untouched test once.

Try it now

Write a split, candidate list, metric, selection rule, and final-test protocol.

Language of the lesson

Know these ideas

Polynomial feature
A transformed feature such as x squared or x cubed.
Model complexity
A model’s flexibility to represent varied patterns.
Underfitting
Failure to capture important structure because a model is too simple.
Overfitting
Learning training-specific noise that harms unseen performance.
Generalization
Performance on new data from the intended setting.
Validation set
Held-out data used for model and hyperparameter choices.

Reason like a practitioner

Misconceptions to correct

  • The model with lowest training error is best.Generalization, not memorization, controls useful performance.
  • Polynomial regression is a completely different non-linear fitting algorithm.It applies linear regression to transformed polynomial features.
  • The test set can be checked after every change.Repeated use leaks information and invalidates the final estimate.
Transfer challenge

Compare at least three polynomial degrees under one split, chart training and validation error, justify the selected complexity, and reserve the final test for one evaluation.

Lesson project · Model comparison

Write a model-selection memo

A comparison of three curves using training and test MSE, with underfitting and overfitting diagnosed.

0%0 of 3 checks
1
Project phase 1

Plan the work

State the goal, audience or user, and the evidence a strong result needs. Explain how Mean squared error changes your plan.

2
Project phase 2

Create the deliverable

Compare three candidate curves using training and test MSE. Choose the best model for new data and defend the choice without selecting only the lowest training error.

3
Project phase 3

Prove and improve

Use Underfitting and Overfitting to check the result. Record one piece of evidence, one correction, and one improvement you would make next.

Offline referenceRead the independent walkthrough and practice notes

Why this lesson matters

Compare linear and polynomial models with mean squared error, add complexity only when it improves unseen predictions, and diagnose underfitting and overfitting.

The goal is not to memorize vocabulary. By the end of the lesson, you should be able to use the ideas in a realistic situation, explain the reason for your choices, and check whether the result actually works for the intended person or task.

Learning objectives

  • Explain Mean squared error in your own words.
  • Apply Underfitting to a realistic classroom or community example.
  • Connect Mean squared error with Overfitting when making a decision.
  • Complete the practice task and reflect on one improvement.

Core ideas

1. Mean squared error

The average squared difference between predictions and observed values, giving larger mistakes more influence on the score.

In practice: Look for this idea while you complete the lesson task. Pause before each major step and explain how Mean squared error changes what you choose, create, or check.

2. Underfitting

A model is too simple to capture important structure, so it performs poorly even on the data used for training.

In practice: Look for this idea while you complete the lesson task. Pause before each major step and explain how Underfitting changes what you choose, create, or check.

3. Overfitting

A model follows training noise or details too closely and therefore performs worse on new data.

In practice: Look for this idea while you complete the lesson task. Pause before each major step and explain how Overfitting changes what you choose, create, or check.

How the ideas connect

Start with Mean squared error to understand the foundation of the lesson. Use Underfitting to turn that understanding into an action. Then apply Overfitting to check the quality, safety, or usefulness of the result. The three ideas are strongest when you can explain their relationship rather than treating them as separate definitions.

Guided walkthrough

  1. Name the goal. In one sentence, write what you are trying to understand, create, or improve.
  2. Make a prediction. Before touching a device, use Mean squared error and Underfitting to predict what a strong result should look like.
  3. Complete the task. Compare three candidate curves using training and test MSE. Choose the best model for new data and defend the choice without selecting only the lowest training error.
  4. Check the outcome. Use Overfitting to inspect the result. Ask what worked, what did not, and what evidence supports your judgment.
  5. Explain and revise. Tell a partner what you changed and why. Make one small improvement, then compare the new result with the first one.

Worked classroom scenario

Imagine two learners sharing one device. The first learner is the driver and performs the steps; the second is the navigator and reads the goal, predicts the next step, and checks the result. Halfway through the task, switch roles. Both learners should be able to explain how Mean squared error, Underfitting, and Overfitting appeared in the work.

If no device is available, complete the same reasoning on paper: sketch the screen or result, label each decision, and describe what you would test when a device becomes available.

Common mistakes and fixes

  • Rushing into the tool: Write the goal and prediction first so every click or step has a reason.
  • Copying without understanding: After each major step, explain it in your own words to a partner.
  • Accepting the first result: Compare the outcome with the goal and make at least one deliberate improvement.
  • Letting one person control a shared device: Rotate driver and navigator roles so both learners think and practice.

Independent practice

Compare three candidate curves using training and test MSE. Choose the best model for new data and defend the choice without selecting only the lowest training error.

For an extra challenge, adapt the task for a different audience or community need. Write two sentences explaining what changed and which lesson idea guided your decision.

Check your understanding

  1. How would you explain Mean squared error to someone new to the topic?
  2. What is one realistic example of Underfitting outside this classroom?
  3. When might Overfitting prevent a weak, unsafe, or confusing result?
  4. How are Mean squared error and Underfitting connected?
  5. What evidence would convince you that your practice result works?
  6. If you repeated the activity tomorrow, what would you improve first and why?

Key takeaway

Compare linear and polynomial models with mean squared error, add complexity only when it improves unseen predictions, and diagnose underfitting and overfitting.

You are ready to move on when you can explain the three core ideas, complete the practice without copying, and describe one improvement using evidence from your result.