-
-
Notifications
You must be signed in to change notification settings - Fork 25.8k
error_score=nan
issues hidden warnings in model selection utilities when n_jobs>1
#20475
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
error_score=nan
issue hidden warning in model selection utilities when n_jobs>1error_score=nan
issues hidden warnings in model selection utilities when n_jobs>1
I'll try to take a look at this one. |
It probably means we need to wrap |
Looking a bit more at it, the first thing I am going to do is the simple case: when all the test scores are NaN raise a warning in the main process saying that something is probably wrong with the model configuration and that `error_score='raise' is a good way to debug the error. I will leave the more complicated cases for later:
|
Hmmm actually another subtility in this:
ipykernel 5.5.5 (no warnings shown)ipykernel 6.1 (all warnings shown) |
This problem seems related to #12939 and overall the problem stems from the usage of warnings library which is not thread-safe. The solution would be to use the logging library and set the correct logging level when running the application. |
Thanks for your input, I am planning to work on this issue as I mentioned above. Don't worry though if you are looking to contribute to scikit-learn, there should be plenty of other issues to work on 😉. This part of the doc should help you getting started as well. |
By default many model selection tools such as
cross_validate
,validation_curves
and*SearchCV
catch exceptions, raise a warning and score the model withnan
. This can be a nice behavior, especially for*SearchCV
estimators that can explore invalid hyper-parameter combinations.However the warnings can be hidden when they are issued on the stderr of loky workers (python subprocesses), for instance in Jupyter interactive environments:
This is a big usability bug. I think we should refactor the model selection tools to raise the warning from the main process instead of the workers. This would make it possible to:
n_jobs=1
error_score="raise"
in the warning message if they want there code to raise an exception instead of getttingnan
-valued scores.This problem has been causing a lot of confusion to MOOC participants (INRIA/scikit-learn-mooc#377) so it's probably hurting scikit-learn usability significantly.
The text was updated successfully, but these errors were encountered: