Learn Linear Regression step-by-step with a real dataset, model training, and accuracy evaluation.
Linear Regression is one of the simplest and most important Machine Learning algorithms. It helps in understanding relationships between variables and building predictive models.
It models the relationship between input (X) and output (Y):
Y = mX + c
| Hours | Marks |
|---|---|
| 1 | 2 |
| 2 | 4 |
| 3 | 5 |
| 4 | 4 |
| 5 | 5 |
| 6 | 7 |
| 7 | 8 |
| 8 | 9 |
| X | Y |
|---|---|
| 1 | 2 |
| 2 | 4 |
| 3 | 5 |
| 4 | 4 |
| 5 | 5 |
| 6 | 7 |
| X | Y |
|---|---|
| 7 | 8 |
| 8 | 9 |
After training:
Y = 0.857X + 1.5
| X | Actual | Predicted |
|---|---|---|
| 1 | 2 | 2.36 |
| 2 | 4 | 3.21 |
| 3 | 5 | 4.07 |
| 4 | 4 | 4.93 |
| 5 | 5 | 5.79 |
| 6 | 7 | 6.64 |
Training Accuracy: 91%
Testing Accuracy: 95%
Without splitting, models may memorize data instead of learning patterns, leading to poor real-world performance.
If you want to build Machine Learning models without heavy coding, try:
Neural Network Designer
👉 Visit: www.neuralnetworkdesigner.net
Linear Regression is the foundation of Machine Learning. Master it well, and you unlock the ability to build powerful predictive models.