A model can report nearly perfect scores yet fail on new cases. Overfitting occurs when it learns the training data too closely—for example, memorizing a few high-risk medicine descriptions instead of learning patterns that generalize. Unusually high, flat precision and recall curves are a reason to investigate, not proof that the model will work on unseen medicines. section 4.6.5
Figure 4.11 Precision vs. Recall at Different Thresholds.

The precision and recall curves show why exceptionally strong scores across thresholds can prompt an overfitting check. section 4.6.5
Cross-validation checks whether strong performance holds when the model is tested on data withheld from training. In five-fold cross-validation, train on four folds and test on the fifth, repeating until each fold has served as the test set. Review the fold results rather than relying on one attractive graph. section 4.6.5
A medical risk classifier
Five folds report accuracies from 0.9339 to 0.9680, with an average of 0.9543. These results provide a check beyond the original curves, but accuracy alone does not describe the safety tradeoff. A lower decision threshold favors recall and more false alarms; a higher threshold favors precision but may miss real risks. section 4.6.5
Training design can also reduce reliance on specific features. In a text-classification pipeline, SpatialDropout1D randomly turns off 25% of word vectors during training, discouraging the model from depending too heavily on particular words. This precaution is especially relevant when data is limited; it does not replace evaluation on withheld data. section 4.6.6 section 4.6.5
































