Created
February 2, 2020 18:10
-
-
Save aialenti/1639d926aaebf6c67dfb84583654ed6d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def get_grid_iterable(): | |
param_grid = {'learning_rate': [float(v) for v in np.arange(0.01, 0.25, 0.01)], | |
'colsample_bytree': [float(v) for v in np.arange(0.8, 1.01, 0.1)], | |
'subsample': [float(v) for v in np.arange(0.5, 1.01, 0.1)], | |
'n_estimators': [int(v) for v in np.arange(100, 3000, 100)], | |
'reg_alpha': [float(v) for v in np.arange(0.01, 0.5, 0.05)], | |
'max_depth': [int(v) for v in np.arange(3, 14, 1)], | |
'gamma': [int(v) for v in np.arange(0, 10, 2)] | |
} | |
grid_iter = [] | |
length = 1 | |
for k in param_grid: | |
grid_iter.append(param_grid[k]) | |
length *= len(param_grid[k]) | |
return itertools.product(*grid_iter), list(param_grid.keys()), length-1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment