Curvingo · Made in India

Glossary

Select one of the keywords on the left…

Linear RegressionUnderstanding What Our Line Means

Reading time: ~10 min

A big strength of linear regression is that its numbers mean something you can say in plain words. Riya's line is \hat{y} = 6x - 100.

  • The slope, 6: every extra degree of temperature brings about more kulfis.
  • The intercept, −100: at 0 °C the line predicts kulfis.

Minus 100 kulfis? Riya cannot un-sell a kulfi. What went wrong?

The model was trained badly
0 °C is far outside the temperatures Riya recorded
Riya sells negative kulfis in winter

Riya's data only covers 24 °C to 40 °C. Using a model far outside the range of its data is called extrapolation, and it is risky: the line has no idea what happens on a cold day. Inside the range, the intercept is just the number that puts the line at the right height.

More Than One Feature

Riya notices that on school holidays the street is empty. She adds a second feature, \text{holiday}, which is 1 on a holiday and 0 on a school day — a yes/no feature. Her new model is

\hat{y} = 6 \times \text{temperature} - 30 \times \text{holiday} - 100

Read each coefficient as "the change in \hat{y} when this feature goes up by 1 and every other feature stays the same". For a yes/no feature that is simply the difference between the two groups: on a holiday Riya sells fewer kulfis than on a school day at the same temperature.

Does a Straight Line Make Sense?

Linear regression always draws a straight line — even when the data is not straight. For which of these datasets is a straight line a bad idea?

A U-shape needs a curve, so a straight line would be too low in the middle and too high at both ends. Two more checks before you trust a line: the errors should look random (no pattern in the red segments), and the data should come from the same kind of situation as the one you predict for.

Speed Round: Read the Line

Get five right to move on.

Sina