Simple Linear Regression models the relationship between a single independent variable (Input, $x$) and a dependent variable (Output, $y$) using a straight line.
📄 View Example: Predicting Salary based on Experience (Opens in new tab)
Click to add points.
What if the data isn't straight? Polynomial Regression fits a curve by adding powers of $x$ ($x^2, x^3...$).
📄 View Example: Trajectory of a Ball (Opens in new tab)
This is still "Linear Regression" technically, because it is linear in the parameters (coefficients), even though it produces a curved line.
Try adding points in a "U" or "S" shape.
Try setting the Degree to 6 with only a few points. Notice how the curve goes wild trying to hit every single point? That is Overfitting. The model is memorizing the noise instead of learning the pattern.
While Simple/Poly Regression uses one input ($x$), Multiple Linear Regression uses multiple independent variables ($x_1, x_2, ...$).
In Multiple Regression, we fit a Hyperplane. We cannot visualize this easily on a 2D screen, but the math (minimizing squared errors) remains exactly the same.
Linear Regression performs math on numbers. But real data often contains text or categories like "City", "Color", or "Yes/No". To use these in our model, we must translate them into numbers using Dummy Variables.
Instead of assigning random numbers (Red=1, Blue=2, Green=3) which would confuse the model into thinking Green > Blue, we create separate "Switch" columns for each category.
| Color | Value |
|---|---|
| Red | 1 |
| Blue | 2 |
| Green | 3 |
Error: Model assumes Green is "3x more" than Red.
| Is_Red | Is_Blue | Is_Green |
|---|---|---|
| 1 | 0 | 0 |
| 0 | 1 | 0 |
| 0 | 0 | 1 |
Result: Each category is treated independently.