Linear Regression

noun

say it: “LIN-ee-er rih-GRESH-un” /ˈlɪniər rɪˈɡrɛʃən/

A simple model that guesses a number using the straight line that runs closest to the examples it learned from.

What is linear regression?

Linear regression is a model that guesses a number with the straight line that runs closest to its examples: a starting point plus a slope times each feature. In scikit-learn it's LinearRegression.

from sklearn.linear_model import LinearRegression
model = LinearRegression()
model.fit([[72], [85], [91]], [40, 65, 80])   # temperature -> cups sold
print(model.predict([[80]]))                   # [56.13...], about 56 cups

In a sentence

  • “She started with linear regression before trying anything fancier.”
  • “Linear regression learned that each extra degree sells about two more cups.”

Level: Journeyman · More AI Basics terms at this level

Updated