K-fold cross validation - best instance of model


#1

Hi,

Which instance of model will be chosen from k fold cross validation.
For instance,

from sklearn.linear_model import LinearRegression
from sklearn.model_selection import cross_val_score

lin_reg = LinearRegression()
scores = cross_val_score(lin_reg, housing_prepared, housing_labels,scoring=“neg_mean_squared_error”, cv=10)

The above cross validation will perform 10 iteration of training on lin_reg model using cross validation samples from housing_prepared and returns list of deviation / error occurred during each iteration as scores. Subsequently, this scores will help in comparing different models against lin_reg.

But my question - how to choose best instance of lin_reg model from the 10 cross validation iteration to avoid under and over fitting of lin_reg model, because each iteration has its own set coefficients.

Thanks,
Raghav