imagine have some curve that swoops way up and then back down again to fit outliers my prediction for something in between there isn' going to be accurate the curve really should be in the middle later in this book we'll talk about the main ways of detecting such overfittingbut for nowplease just observe it and know we'll go deeper later computing the -squared error now we can measure the -squared error by taking the and the predicted values (qy in the @tdpsf function that we have in tlmfbsonfusjdtwe can compute that gspntlmfbsonfusjdtjnqpsus@tdpsf ss@tdpsf qy qsjousthe output is as followsour code compares set of observations to set of predictions and computes -squared for youand with just one line of codeour -squared for this turns out to be which isn' too bad rememberzero is badone is good is to pretty close to onenot perfectand intuitivelythat makes sense you can see that our line is pretty good in the middle section of the databut not so good out at the extreme left and not so good down at the extreme right so sounds about right activity for polynomial regression recommend that you get down and dirty with this stuff try different orders of polynomials go back up to where we ran the qpmzgju function and try different values there besides you can use and that would go back to linear regressionor you could try some really high amount like and maybe you'll start to see overfitting so see what effect that has you're going to want to change that for examplelet' go to third-degree polynomial oqbssbz qbhf qffet oqbssbz qvsdibtf"npvou qoqqpmz oqqpmzgju  