Machine learning: overfitting phenomena Please explain why we should avoid "overfitting phenomena" in training
a learning model and how to detect it?

You can detect over-fitting by comparing training and test performance. For instance, you can divide the data $X$ into training and test sets and compute a loss function as the number of training samples increases. The distance between training and test loss will be proportional to the amount of over-fitting.
In order to avoid over-fitting (and do well on out-of-sample or test data), it is common to use cross-validation for model parameter tuning. Cross-validation divides the data into K folds and uses K-1 for training and 1 for testing averaging results over K iterations. This helps avoid over-fitting and selects the right parameters for the model.
