AI & LLMs

Linear Regression

The simplest predictive model: fit a straight line (weighted sum of features) to predict a continuous value.

Linear regression predicts a continuous number as a weighted sum of the input features plus a bias — fitting the line (or hyperplane) that minimizes squared error between predictions and actual values. It is the foundational supervised-learning model and a baseline for any regression task.

Worked example: predicting house price from size, bedrooms, and age fits price ≈ w1·size + w2·beds + w3·age + b, and each weight reads directly as “one more bedroom adds w2 dollars.” Gotcha: it assumes a linear relationship and is sensitive to outliers (squared error punishes them heavily) and to correlated features (multicollinearity makes the weights unstable and uninterpretable) — check residuals and consider regularization (ridge/lasso) before trusting the coefficients.