Parameters Search

lgb_grid_search = lgb.LGBMRegressor()

param_grid1 = {
    'learning_rate' : [0.01, 0.05, 0.1, 0.2],
    'max_depth' : [3, 6, 9, 12],
    'min_child_samples' : [5, 10, 20, 50],
    'n_estimators' : [10, 20, 40, 50],
    'num_leaves' : [5, 10, 20, 40],
    'reg_alpha' : [0.1, 0.2, 0.4, 0.5],
}

grid_search = GridSearchCV(
    estimator=lgb_grid_search,
    param_grid=param_grid1,
    cv=5
).fit(X_in, y_in)

best_gridsearch = grid_search.cv_results_["params"][
    np.argmin(grid_search.cv_results_["rank_test_score"])
]
print(best_gridsearch)
Previous
Next