Overfitting happens when a machine learning model is trained so that it learns the details and noise in the training data too closely: its performance is very high on the training data but poor on new data it has never seen. In other words, the model memorizes the data instead of learning the general patterns from it. Overfitting usually appears when the model is too complex or the data is small or not varied. Example: a model that learns to predict house prices and remembers every house in the training data exactly, but fails to predict the price of a new house because it did not generalize the rules.
