Training and testing
Training is the process by which a machine learning model adjusts its internal parameters to fit the patterns in a dataset. Testing is the process of evalu...
How Models Learn and How We Check Their Work
Training is the process by which a machine learning model adjusts its internal parameters to fit the patterns in a dataset. Testing is the process of evaluating how well those learned patterns apply to new, unseen data. Keeping these two phases separate is one of the most fundamental principles in machine learning practice.
During training the model sees each example, makes a prediction, compares it to the true label, calculates an error, and uses that error to update its parameters. This cycle repeats many times over the training data. The goal is not merely to memorize the training examples but to capture underlying patterns that generalize.
Testing uses a separate portion of the data — the test set — that the model has never encountered. Measuring accuracy on the test set gives an honest estimate of how the model will behave in the real world. If you measured accuracy only on training data, you would get an overly optimistic picture because the model has already adapted to those exact examples.
A critical rule: never use test data to make decisions about the model. As soon as you peek at test results and adjust the model accordingly, the test set becomes contaminated and no longer provides a truly independent estimate. That is why practitioners often use a third split called the validation set for tuning, preserving the test set for a final, untouched evaluation.
A concrete example: a handwriting recognition model achieves 99 percent accuracy on its training images but only 82 percent on new handwritten digits from different people. The gap reveals overfitting — the model memorized quirks of the training writers rather than learning general digit shapes.
Exam tip: if asked why we split data, the core answer is to get an unbiased estimate of generalization performance — how well the model handles data it has not seen before.