1

I am training to tune parameters for my random forest. I am using Grid Search CV.

Here is my parameter grid.

rf = RandomForestRegressor(random_state = 42)

param_grid = {
    'n_estimators': [100,200,300],
     'max_depth': np.arange(3,8,1),
     'max_features': ['auto'],
     'min_samples_leaf': [0.01,0.02],
     'min_samples_split': min_samples_split,
     'bootstrap': [True]
}

Here is my attempt to do grid search

rs = GridSearchCV(rf,
                  return_train_score=True, 
                  param_grid=param_grid, 
                  scoring="r2",
                  cv=5, verbose = 2, n_jobs = -1)

When I run this I get this user warning: UserWarning: One or more of the test scores are non-finite:

When I check

rs.cv_results_

All the split test scores are nan. All the data types are numeric and I have tried this with multiple scoring metrics. However, the gridsearch still returns best estimator. What is going on here?

Mooted
  • 13
  • 2

0 Answers0