fit_cv function

Fits a grid search to the training data with cross-validation