How do I know my model overfits? We already have multiple questions on overfitting, however, we also observe certain kinds of questions to re-occur regularly that ask how to diagnose overfitting in practice. Let's try giving an authoritative answer for such a question, so it could serve as a reference.
How do I know my model overfits? For example: does perfect training error mean overfitting, or how big does the gap between training and test error need to be to call it overfitting?

Re last question: There is no fixed threshold. "Overfitting" is not a binary concept. Particularly, some people will use the term if the test error is any larger than what should be expected from the training error (a certain difference is almost always to be expected), some others may not call a model overfitted that has a substantially larger test error than the training error, as long as the test error is still better than what they get from alternative models. I'd say both are legitimate, and people should say more precisely what they mean. Another issue is that a test error that is achieved on random parts of the same data may still be optimistic when it comes to predicting proper new data.
