‹ Class 7 · Ch 1
AI Domains and Applications · Principle 1 of 6

Predict a number

How a line through past data guesses new values.

Think

Guess the fare

Meera noted three auto-rickshaw fares: 2 km cost ₹52, 6 km cost ₹104 and 9 km cost ₹152. What would you guess for a 7 km trip?

What this lesson covers

The idea

Regression predicts a number from past data, and the prediction is trustworthy only near the data it came from.

Guess the fare

Meera noted three auto-rickshaw fares: 2 km cost ₹52, 6 km cost ₹104 and 9 km cost ₹152. What would you guess for a 7 km trip?

  • About ₹80
  • About ₹125
  • About ₹180

Fit a line to the dots

Each dot is a real trip from the past: how far it went and what it cost. Drag the two sliders until the line runs close to the dots.

The orange sticks show each miss. When the average miss is small, press Show the machine's line and compare what both lines say for 7 km.

The line makes a guess

Nobody measured a 7 km trip, yet the line still gives a fare for it. The line is the pattern that the dots show.

The machine found a line that keeps the misses small overall, using careful arithmetic instead of sliders. For 7 km its line says about ₹124. These fares came from trips of 1 to 9 km, so the line is most trustworthy there.

Regression means using past data to predict a number, such as a fare.

Regression is for numbers. Choosing a group, such as spam or safe, is a different job that comes next.

Notes

Regression means using past data to predict a number, such as a fare.

Trust a prediction most inside the range of the data it came from. Far outside that range, it is only a guess.

Check yourself

Ishaan's canteen has records of how many glasses of lassi it sold on days of different heat. Which question is a job for regression?

A line was made from fares for trips of 1 to 9 km. It says a 200 km trip costs about ₹2,800. How much should Meera trust that?

A line misses five dots by ₹2, ₹6, ₹0, ₹4 and ₹8. What is the average miss?

Answer: 4 rupees

The misses add up to 2 + 6 + 0 + 4 + 8 = 20. Sharing that over 5 dots gives 20 ÷ 5 = 4 rupees.

  • Will lassi or tea sell more today?. That asks for a group, lassi or tea, not a number. Choosing a group is a different job, and you will meet it next.
  • How many glasses of lassi will we sell tomorrow? — correct. Yes. The answer is a number nobody has counted yet. The canteen's records show how sales change with the heat.
  • How many students are in the canteen right now?. That is a count you can make by looking. Regression predicts a number you cannot see yet, using past data.
  • Fully, because the machine drew the best possible line. It is the best line for trips of 1 to 9 km, which is all the data it has seen. A trip of 200 km is far outside that.
  • Mostly, because fares keep rising in a straight line. Fares often follow a line inside the range that was measured. Far outside it, the pattern may change, so the line may be wrong.
  • As a rough guess, because it only saw trips up to 9 km — correct. Yes. A line is most trustworthy near the data it came from. A 200 km trip may have a fixed out-of-town rate, and the line cannot know that.
Hold to talk

Subscription Status