Solved – Leave-one-out cross validation

cross-validationregressionspss

I am working about elaborate a simple linear regression
so I need to evaluate many models.
I am asking how I can use leave-one-out cross validation to validate a simple linear regression.

Best Answer

Say you have $n$ training examples. Then to do leave-one-out cross validation, you would first pick a training example to leave out, then perform your linear regression algorithm (gradient descent or another) on the remaining $n-1$ examples. You would then pick a different training example to leave out, perform regression on the remaining $n-1$ examples, and iterate until you've left out all examples exactly once. At the end, you would compare all $n$ coefficient vectors that you generated from your $n$ regressions to see if the coefficient values are approximately the same.