we see that for the fitted curve lies closer to the data pointsbut is further away from the dashed true polynomial curveindicating that we overfit the choice (the true cubic polynomialis much better than or indeed (straight lineg each function class gives different learner gt to assess which is betterwe should not simply take the one that gives the smallest training loss we can always get zero training loss by taking nbecause for any set of points there exists polynomial of degree that interpolates all pointsinsteadwe assess the predictive performance of the learners using the test loss ( )computed from test data set if we collect all test feature vectors in matrix and the corresponding test responses in vector thensimilar to ( )the test loss can be written compactly as bk ` (gt ky where is given by ( )using the training data figure shows plot of the test loss against the number of parameters in the vector bthat isp the graph has characteristic "bath-tubshape and is at its lowest for correctly identifying the polynomial order for the true model note that the test lossas an estimate for the generalization risk ( )becomes numerically unreliable after (the graph goes downwhere it should go upthe reader may check that the graph for the training loss exhibits similar numerical instability for large pand in fact fails to numerically decrease to for large pcontrary to what it should do in theory the numerical problems arise from the fact that for large the columns of the (vandermondematrix are of vastly different magnitudes and so floating point errors quickly become very large finallyobserve that the lower bound for the test loss is here around which corresponds to an estimate of the minimal (squared-errorrisk ` test loss number of parameters figure test loss as function of the number of parameters of the model this script shows how the training data were generated and plotted in python