What makes a model linear

Pengantar Pemodelan Linear di Python

Jason Vestuto

Data Scientist

Taylor Series

Things to know:

  1. approximate any curve
  2. polynomial form: y = a0 + a1*x + a2*x**2 + a3*x**3 + .... + an*x**n
  3. often, first order is enough: y = a0 + a1*x
Pengantar Pemodelan Linear di Python

Series Terms: a0=1

Plot of a constant y=1 line with slope zero

Pengantar Pemodelan Linear di Python

Series Terms: a1=1

Plot of line with nonzero slope y = 1*x

Pengantar Pemodelan Linear di Python

Series Terms: a2=1

Plot of quadratic line y = x^2, half a parabola, up turned

Pengantar Pemodelan Linear di Python

Combining all Terms

Plot of 4 curves, y=1 in red, y=x in green, y=x^2 in blue, and the sum of those three, in black

Pengantar Pemodelan Linear di Python

Real Data

Scatter plot of sea level change versus time in years

Pengantar Pemodelan Linear di Python

Zeroth Order

Scatter plot of data, sea level versus time, and line plot of model y=6.5, the mean of the data

Pengantar Pemodelan Linear di Python

First Order

Scatter plot of data, sea level versus time, and line plot of model y=5 + 0.08*x, with the model line passing through most data points

Pengantar Pemodelan Linear di Python

Higher Order

Scatter plot of data, sea level versus time, and line plot of model y=5 + 0.08*x + 0.0025*x^2, with the model line fitting data points

Pengantar Pemodelan Linear di Python

Over-fitting

Scatter plot of data sea level versus time, twice as far in time, with 2 models, line plot y=6.5 + 0.08x fitting data well, and line plot of model y=5 + 0.08*x + 0.0025*x^2, deviating strongly at later times

Pengantar Pemodelan Linear di Python

Let's practice!

Pengantar Pemodelan Linear di Python

Preparing Video For Download...