The Linear Model Equation
What you'll learn: How linear regression models use a simple mathematical equation to predict continuous values from input features.
Core Idea
In linear regression, we model the relationship between inputs and outputs using a straight-line equation. You already know the simplest version from algebra: y = mx + b, where:
- y is the predicted output (what we're trying to guess)
- x is the input feature
- m is the slope (how much y changes when x changes)
- b is the y-intercept (where the line crosses the y-axis)
Think of this as a rule: "To predict house price (y), multiply square footage (x) by some amount (m), then add a base value (b)."
Generalizing to Multiple Features
Real-world problems rarely have just one feature. When predicting house prices, you might consider square footage, number of bedrooms, age, and location. The equation generalizes to:
y = w₁x₁ + w₂x₂ + w₃x₃ + ... + wₙxₙ + b
Here:
- Each xᵢ is a different feature (square footage, bedrooms, etc.)
- Each wᵢ is a weight (like the slope m, but one per feature)
- b is the bias term (the intercept)
The model learns these weights and bias during training. A large positive weight means that feature strongly increases the prediction; a negative weight means it decreases it.
Analogy: Imagine you're judging a talent show. Each performance aspect (singing, dancing, stage presence) gets a weight showing how much it matters to you, then you add a baseline score (bias). Your final score is the weighted sum.
Key Takeaway: The linear model equation is a weighted sum of features plus a bias term, providing a simple yet powerful foundation for prediction tasks in machine learning.