Linear Regression - AI Model in Action
Linear regression is an AI model used to predict continuous values, like house price.
ARTIFICIAL INTELLIGENCE
12/19/20252 min read
Linear Regression: A Foundation of AI Models
Artificial Intelligence (AI) operates on mathematical models and algorithms. These models form the backbone of solutions to real-world problems that require data-driven decision-making.
Broadly, AI models can be categorized into two approaches: Regression and Classification.
Regression is used when the output is a continuous set of values, such as predicting house prices in a locality.
Classification is applied when the output is categorical or binary, for example, determining whether a person has a disease (yes/no).
Another distinction is whether the model is supervised or unsupervised:
In supervised learning, the model learns from past datasets to make future predictions.
In unsupervised learning, no labeled data is provided; instead, the model identifies intrinsic patterns within the data.
What is Linear Regression
Linear regression is a supervised learning model based on the assumption that there is a linear relationship between input and output variables. In simple terms, the output changes proportionally with respect to the input.
A straight line is drawn across the data points to represent this relationship. The goal is to minimize the residual distance—the gap between the predicted values and the actual data points.
Equation and Variables
In any dataset, there are two types of variables:
Independent variable (X): The input, which does not depend on other values.
Dependent variable (Y): The output, which changes based on the input variable.
The equation of linear regression is:
y = mx + b
Where:
m = slope (controls the tilt/angle of the line)
b = intercept (the value of y when x=0)
By adjusting the slope m, the model reduces the residual distance, thereby improving accuracy. Linear regression can involve a single independent variable (simple linear regression) or multiple variables (multiple linear regression).
Error Correction
To measure accuracy, linear regression uses the least squares error method. This calculates the squared difference between the actual and predicted values:
Error = yactual − ypredicted
Squaring ensures that negative differences don’t cancel out positive ones. The lower the error, the better the model’s performance.
Limitations of Linear Regression
While powerful, linear regression has some drawbacks:
Assumption of linearity: If the relationship between input and output is not linear, the model produces skewed results.
Sensitivity to outliers: Extreme values can bias the model, reducing accuracy and giving undue weight to certain data points.
