- View
Imagine that Mike, Ana and Luka are preparing for a math exam and that they all use the same collection. Mike was slacking off and only practicing the tasks only slightly, Ana was diligent and practiced carefully and comprehensively all week, while Luka decided to memorize the tasks. Can you guess who did the best in the test? Of course, Ana!
A collection of problems can be thought of as an abstract set of data consisting of inputs (task texts) and outputs (solutions). A machine learning model can, like Pera, learn only a few connections in the data and make a lot of mistakes in practice. Such a property of the model is called underfitting. The model can also overdo the level of detail, like Luke, and lose the power to handle some new data. Such a property of the model is called overfitting. It would be best if the model adopted the right information and could, like Anna, successfully solve both familiar and some new tasks. This property of the model is called generalization.
An example of under-adaptation and over-adaptation can be illustrated by the following figure. Imagine that along the x-axis are the values of an attribute, along the y-oce are the values of the target variable, and that the dashed line shows the model. The model on the left is not the best choice considering the arrangement of the dots, it seems too simple. The data looks more like a "glass," so a square model that has this form might be a better solution. We can see him in the middle picture. In the image on the right, we see a model that consistently follows every point in the data set and is completely adapted to it.

Example of under-adaptation and over-adaptation
The task of finding the optimal model and balancing between underfitting and overfitting is not easy. Fortunately, the field of machine learning defines the protocols and techniques that we can use to keep track of each of these situations. For example, large differences in the performance of the model on the training set and the test set indicate that the model has been readapted. This is usually due to choosing a more complex model than necessary (as in the upper right image) or training the model for a longer time. On the other hand, low values of quality measures in both the training set and the test set indicate that the model has not learned enough from the data, is too simple (as in the upper left image), or needs more attributes.
Good generalization is a property that allows machine learning models to be successfully applied in practice. Only a small part of the data that is available is used to train them, and yet, we expect them to behave well during the application and over new data that they have never encountered. That is why it is important that the datasets are representative, i.e. They are both sufficiently rich and diverse to suit the problem being addressed, as well as careful monitoring of possible under-adaptations and over-adaptations of the model.