# How can the generalization error be estimated?

How would you estimate the generalization error? What are the methods of achieving this?

Generalization error is the error obtained by applying a model to data it has not seen before. So, if you want to measure generalization error, you need to remove a subset from your data and don't train your model on it. After training, you verify your model accuracy (or other performance measures) on the subset you have removed since your model hasn't seen it before. Hence, this subset is called a test set.

Additionally, another subset can also be used for parameter selection, which we call a validation set. We can't use the training set for parameter tuning, since it does not measure generalization error, but we can't use the test set too since our parameter tuning would overfit test data. That's why we need a third subset.

Finally, in order to obtain more predictive performance measures, we can use many different train/test partitions and average the results. This is called cross-validation.

Error Estimation is a subject with a long history. The test-set method is only one way to estimate generalization error. Others include resubstitution, cross-validation, bootstrap, posterior-probability estimators, and bolstered estimators. These and more are reviewed, for instance, in the book: Braga-Neto and Dougherty, "Error Estimation for Pattern Recognition," IEEE-Wiley, 2015.

It's basically not possible to test besides some empirical experiments. All the generalization bounds only apply if your process actually follows the model assumptions which you don't actually know to be true.

• This is wrong. The generalization error can be estimated. This answer provides a way to estimate the generalization error. Now, if you're talking about generalization bounds, that's something different. However, the question was about estimating the generalization error. – nbro Nov 7 '20 at 17:39
• You don't know if your validation data actually comes from the same distribution or.not basically it's all guess, you never know much of anything until you run the system real time. – FourierFlux Nov 7 '20 at 20:37
• The point being made by nbro is that you are estimating something or approximating something. It may not be correct but it is the best you can do, hence the word 'estimate'. What you are talking about is the actual generalization error on the true distribution compared to the error on the sampled distribution (which gives you the estimated error of the true distribution). – user9947 Nov 8 '20 at 13:06