Simple Linear Regression
Simple Linear Regression models the relationship between one input variable (the feature) and one output variable (the target) by fitting a straight line through the data - it's the most fundamental predictive modeling technique in statistics and machine learning.
The Equation of the Line
y = m * x + c
# y = predicted output (target)
# x = input (feature)
# m = slope - how much y changes for a one-unit change in x
# c = intercept - the value of y when x is 0
A Simple Example
Predicting exam scores based on hours studied - as hours studied increases, the score is expected to increase roughly proportionally.
How the Line is Fitted
The model finds the values of slope and intercept that minimise the total squared distance between the actual data points and the predicted line - a method known as Ordinary Least Squares.
Interpreting the Slope
If the slope is 5, it means for every additional hour studied, the predicted score increases by 5 points - this direct interpretability is one of the biggest advantages of linear regression over more complex models.
Coming Up Next
Next, you'll implement Simple Linear Regression in Python using real code.