I am using sklearn's GridSearchCV to get best parameters for my Random Forest Model.
Below is my code
model = RandomForestRegressor(random_state = 1, n_jobs = -1)
param_grid = {"n_estimators": [5, 10]}
for parameter, param_range in dict.items(param_grid):
#get_optimum_range(parameter, param_range, RFReg, index)
grid_search = GridSearchCV(estimator=model, param_grid = {parameter: param_range})
grid_search.fit(X_train, y_train)
results = pd.DataFrame(grid_search.cv_results_)
My results dataframe is as below
If you observe my mean_test_score
is negative but mean_train_score
is positive.
What could be the reason for the same ?
My dataframe sizes
print(X_train.shape)
print(y_train.shape)
print(X_test.shape)
print(y_test.shape)
(538, 3)
(538,)
(112, 3)
(112,)