I am trying to run a grid search where the model will be trained on my training set and tested only on a preset validation set (as requested by a manuscript reviewer).
I have broken my data into a train, validation and test cohort, and will train and tune with the validation cohort, and test the final model with the test cohort. I recognize that GridSearchCV is ideal, but I am in need of performing a grid search without the CV aspect.
ex_parameters_to_be_tuned = {
'learning_rate' : [0.1, 0.01, 0.001,0.0001],
'subsample' : [0.25, 0.50, 0.75, 1]
}
model = lgb.LGBMRegressor(objective = 'Regression', metric = 'rmse', boosting = 'gbdt')
#####Need to switch this to not CV and make it so it trains on "training data" and tests on "validation data"
grid = GridSearchCV(estimator = model, param_grid=ex_parameters_to_be_tuned, scoring = 'neg_root_mean_squared_error')
grid.fit(X_valid, y_valid)
print('best score:', grid.best_score_)
print('best param:', grid.best_params_)
I would like it to be something like
grid.fit(X_train, y_train)
grid.test(X_valid, y_valid)
How can I do a grid search without CV using train and validation data only?