Is it possible to see the progress of GridSearchCV in a Jupyter Notebook? I’m running this script in python:
JavaScript
x
11
11
1
param_grid = {'learning_rate': [0.05, 0.10, 0.15, 0.20, 0.25, 0.30] ,
2
'max_depth' : [3, 4, 5, 6, 8, 10, 12, 15],
3
'min_child_weight' : [1, 3, 5, 7],
4
'gamma' : [0.0, 0.1, 0.2 , 0.3, 0.4],
5
'colsample_bytree' : [0.3, 0.4, 0.5 , 0.7],
6
'verbose' : [100] }
7
8
xgboost_reg = XGBRegressor()
9
grid_search = GridSearchCV(xgboost_reg, param_grid, cv=5, scoring='neg_mean_squared_error', return_train_score=True)
10
grid_search.fit(my_data, my_labels, verbose=False)
11
I can see only some warnings in the output of the cell.
Advertisement
Answer
You want the verbose
parameter:
JavaScript
1
3
1
grid_search = GridSearchCV(xgboost_reg, param_grid, cv=5, scoring='neg_mean_squared_error', return_train_score=True, verbose=2)
2
grid_search.fit(my_data, my_labels, verbose=False)
3
An example of what I got on toy data:
JavaScript
1
14
14
1
Fitting 3 folds for each of 5 candidates, totalling 15 fits
2
[CV] C=0.1 ..
3
[CV] .. C=0.1, total= 0.0s
4
[CV] C=0.1 ..
5
[CV] .. C=0.1, total= 0.0s
6
[CV] C=0.1 ..
7
[CV] .. C=0.1, total= 0.0s
8
[CV] C=0.5 ..
9
[CV] .. C=0.5, total= 0.0s
10
[CV] C=0.5 ..
11
[CV] .. C=0.5, total= 0.0s
12
[CV] C=0.5 ..
13
[CV] .. C=0.5, total= 0.0s
14