Verbosity option is not working in GridSearchCV (Jupyter notebook)
See original GitHub issueDescribe the bug
So this issue has been addressed before here by darrencl, but the user didn’t follow up with lesteve response.
The problem is that GridSearchCV doesn’t show the elapsed time periodically, or any log, I am setn_jobs = -1
, and verbose = 1
. I tried setting n_jobs
to other values, the same with verbose
, but nothing happened.
Note that this didn’t happen until I updated scikit-learn from version 0.22.1 to 1.0.2.
lesteve in his response assumed that this problem is due to ipykernel <6
, which is not the case with me.
Steps/Code to Reproduce
from sklearn.model_selection import GridSearchCV
from sklearn.ensemble import RandomForestClassifier
from sklearn import datasets
iris = datasets.load_iris()
params = {'n_estimators':[10,20,30,40,50,60],
'max_depth':[20,50,60,70,80]}
grid_obj = GridSearchCV(estimator=RandomForestClassifier(), param_grid=params, n_jobs=-1, verbose=1, cv=5)
grid_obj.fit(iris.data, iris.target)
Expected Results
This is the output when using version 0.22.1
Actual Results
Fitting 5 folds for each of 30 candidates, totalling 150 fits
Versions
System:
python: 3.8.5 (default, Sep 3 2020, 21:29:08) [MSC v.1916 64 bit (AMD64)]
executable: D:\Programs\ApplicationsSetup\anaconda3\python.exe
machine: Windows-10-10.0.19041-SP0
Python dependencies:
pip: 21.2.2
setuptools: 58.0.4
sklearn: 1.0.2
numpy: 1.19.2
scipy: 1.6.2
Cython: 0.29.25
pandas: 1.4.1
matplotlib: 3.5.1
joblib: 1.1.0
threadpoolctl: 2.2.0
!jupyter --version
Selected Jupyter core packages...
IPython : 7.31.1
ipykernel : 6.4.1
ipywidgets : 7.6.5
jupyter_client : 6.1.12
jupyter_core : 4.9.1
jupyter_server : 1.13.5
jupyterlab : 3.2.9
nbclient : 0.5.11
nbconvert : 6.1.0
nbformat : 5.1.3
notebook : 6.4.9
qtconsole : 5.2.2
traitlets : 5.1.1
Issue Analytics
- State:
- Created 2 years ago
- Comments:15 (7 by maintainers)
Top Results From Across the Web
GridSearchCV no reporting on high verbosity - Stack Overflow
In my experience, verbose output seems to work not so well with multiprocessing (though I usually run it from IPython notebooks, which might...
Read more >GridSearchCV does not print progress log with n_jobs=-1
Hi, GridSearchCV or RandomizedSearchCV in the newer versions of Scikit-learn (v 0.24. 0 and above) do not print progress log with parallel-processing (e.g.,...
Read more >Find optimal parameters using GridSearchCV - ProjectPro
ProjectPro can help you get best parameters from gridsearchcv. To know more about how to find optimal parameters using GridSearchCV, ...
Read more >How to Grid Search Hyperparameters for Deep Learning ...
By setting the n_jobs argument in the GridSearchCV constructor to -1, ... You can see that SGD is not very good on this...
Read more >Hyperparameter Tuning with GridSearchCV - Great Learning
verbose : you can set it to 1 to get the detailed print out while you fit the data to GridSearchCV 6.n_jobs: number...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
When I use:
I can see verbose in terminal instead of notebook. I do not know why, but it works for me.
Are there any updates on this? I have the same problem on Apple M1. I’m also teaching machine learning and I see that most of my students also have this problem. We set n_jobs=4 for them. No verbosity setting gives any output while running, but the output appears after the job is completed (often even in a different cell. It’s very annoying since it’s demotivating for the students if they don’t know how far along their gridsearch is