In the Cross-validation and hyperparameter tuning notebook, why do we have to pass the cross validation parameter (cv=2
) in the GridSearchCV
initialization?
model_grid_search = GridSearchCV(model, param_grid=param_grid, n_jobs=4, cv=2)
In the next line we are anyway going to cross validate, so I found it redundant and complex.
cv_results = cross_validate(
model_grid_search, data, target, cv=3, return_estimator=True)
Have I understood this correctly? If not, could someone explain why this is necessary?
Thank you