CalibratedClassifierCV doesn't support groups parameter in fit method
See original GitHub issueDescription
With classes like sklearn.model_selection.GridSearchCV
and even skopt.BayesSearchCV
they take a cv
parameter that can be any object that produces train/test splits. In the case of using sklearn.model_selection.GroupKFold
as the cv
object, it requires a groups
variable to be passed to fit
. In both these classes, they allow groups
to be passed to fit
that’s then passed to the underlying GroupKFold
. However, sklearn.calibration.CalibratedClassifierCV
doesn’t allow the groups
variable to fit
even though it says it accepts any cv
object.
Issue Analytics
- State:
- Created 5 years ago
- Reactions:1
- Comments:5 (4 by maintainers)
Top Results From Across the Web
How to use GroupKFold with CalibratedClassifierCV?
Unlike GridSearchCV , CalibratedClassifierCV doesn't seem to support passing the groups parameter to the fit method.
Read more >sklearn.calibration.CalibratedClassifierCV
Parameters to pass to the fit method of the underlying classifier. Returns: selfobject. Returns an instance of self.
Read more >Re: Probability calibration in Dataiku
CalibratedClassifierCV from the classifier trained in Dataiku. My understanding is that the only way to do this is by creating a custom Python ......
Read more >How to Calibrate Probabilities for Imbalanced Classification
Cross-validation is used to scale the predicted probabilities from the model, set via the “cv” argument. This means that the model is fit...
Read more >Scikit correct way to calibrate classifiers with ... - Cross Validated
Which has the disadvantage of leaving less data for training. Also, if CalibratedClassifierCV should only be fit on models fit on a different ......
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
This is I guess another example of what could potentially be solved by PR #9566. You can check issues #11429 and #4497 for more detailed discussion on the matter. Developers are mostly busy with
0.20
release at the moment. I’m pretty sure we’ll get back to this soon after the release.In the meantime, you can check the answer I gave to the question “sklearn GridSearchCV not using sample_weight in score function” on stackoverflow useful. I haven’t applied it to
GroupKFold
, but I suspect it may be applicable there as well. You may need to write a wrapper aroundGroupKFold
which doesn’t expectgroups
as input.For anyone else that runs into this same issue before SLEP006 is finished, I’ve uploaded a very simple fix based on version 0.24.1 of sklearn here. This works the same was a
GridSearchCV
and fails gracefully if the cv passed in does not support thegroups
parameter (which may not be desirable depending on your usecase). @DanLeopold