|
| 1 | +# Generalization 👻 |
| 2 | + |
| 3 | +Generalization refers to a model's ability to perform well on new, unseen data. In linear regression, achieving good generalization means that the model captures the underlying trend in the data without overfitting or underfitting. |
| 4 | + |
| 5 | +## Need to know for this section 👨🏽💻 |
| 6 | + |
| 7 | +### Bias and Variance |
| 8 | + |
| 9 | +- <mark>**_Bias_**:</mark> |
| 10 | + |
| 11 | + Bias is the error introduced by approximating a real-world problem (which may be complex) by a simplified model. In linear regression, high bias often occurs when the model is too simple to capture the underlying patterns in the data. |
| 12 | + |
| 13 | + > **_High bias_** can lead to underfitting, where the model fails to capture the underlying trend and performs poorly on both training and test data. |
| 14 | +
|
| 15 | +- <mark>**_Variance_**:</mark> |
| 16 | + |
| 17 | + Variance is the error introduced by the model’s sensitivity to fluctuations in the training data. High variance occurs when the model is too complex and learns not only the underlying patterns but also the noise in the training data. |
| 18 | + |
| 19 | + > **_High variance_** can lead to overfitting, where the model performs very well on training data but poorly on test data due to its excessive complexity. |
| 20 | +
|
| 21 | +</br> |
| 22 | + |
| 23 | + |
| 24 | +</br> |
| 25 | + |
| 26 | +> For the left img is "high bias but low variance". On the other hand, the right img is "low bias and high varaince". Which both cause the overfitting and underfitting! |
| 27 | +
|
| 28 | +### Overfitting vs. Underfitting |
| 29 | + |
| 30 | +- Overfitting: |
| 31 | + |
| 32 | + Occurs when a model learns the noise in the training data rather than the actual signal. This results in excellent performance on training data but poor performance on new, unseen data. |
| 33 | + |
| 34 | + <mark>High variance, low training error, high test error. (low bias)</mark> |
| 35 | + |
| 36 | +- Underfitting: |
| 37 | + |
| 38 | + Occurs when a model is too simplistic to capture the underlying patterns in the data. This results in poor performance on both training and test data. |
| 39 | + |
| 40 | + <mark>High bias, high training error, high test error.</mark> |
| 41 | + |
| 42 | +### Goal Representation |
| 43 | + |
| 44 | +Bias vs. Variance Trade-off: |
| 45 | + |
| 46 | +- **_High Bias (Underfitting)_** ⟶ Simple Model ⟶ High Training Error, High Test Error |
| 47 | +- **_Low Bias, Low Variance_** ⟶ Optimal Model ⟶ Low Training Error, Low Test Error |
| 48 | +- **_High Variance (Overfitting)_** ⟶ Complex Model ⟶ Low Training Error, High Test Error |
| 49 | + |
| 50 | +> Training error is E in and Testing error is E out |
| 51 | +
|
| 52 | +### Note 🚨 |
| 53 | + |
| 54 | +We can visualize overfitting and underfitting by making a learning curve. You can follow the link https://github.com/Kariusdi/Machine-Learning-Class67/tree/main/LearningCurve. |
0 commit comments