Skip to content

Scikit-learn 1.8 compatibility fix#11858

Merged
hcho3 merged 5 commits into
dmlc:masterfrom
hcho3:sklearn_18
Dec 12, 2025
Merged

Scikit-learn 1.8 compatibility fix#11858
hcho3 merged 5 commits into
dmlc:masterfrom
hcho3:sklearn_18

Conversation

@hcho3

@hcho3 hcho3 commented Dec 11, 2025

Copy link
Copy Markdown
Collaborator

Closes #11857

@trivialfis trivialfis mentioned this pull request Dec 11, 2025
10 tasks
@hcho3

hcho3 commented Dec 11, 2025

Copy link
Copy Markdown
Collaborator Author

TODO: Handle validation of CV objects.

tests/python/test_with_sklearn.py::test_pandas_input:

>               raise InvalidParameterError(
                    f"The {param_name!r} parameter of {caller_name} must be"
                    f" {constraints_str}. Got {param_val!r} instead."
                )
E               sklearn.utils._param_validation.InvalidParameterError: The 'cv' parameter of CalibratedClassifierCV must be an int in the range [2, inf), an object implementing 'split' and 'get_n_splits', an iterable or None. Got 'prefit' instead.

../../miniforge3/lib/python3.12/site-packages/sklearn/utils/_param_validation.py:98: InvalidParameterError

@hcho3

hcho3 commented Dec 11, 2025

Copy link
Copy Markdown
Collaborator Author

The PR is now ready for review. I was able to run all pytests locally with sklearn 1.8.

@jcrist jcrist left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was asked offline for a quick review - overall LGTM!

Comment thread tests/python/test_with_sklearn.py
Comment thread python-package/xgboost/sklearn.py

@betatim betatim left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for putting in the work to catch up with the various changes from scikit-learn!

I also saw #11863, maybe worth considering using the scientific python nightlies (docs on using them) to add a job to your nightlies for scikit-learn and other PyData packages xgboost depends on.

@hcho3
hcho3 merged commit e422814 into dmlc:master Dec 12, 2025
65 checks passed
@hcho3
hcho3 deleted the sklearn_18 branch December 12, 2025 08:47
trivialfis pushed a commit to trivialfis/xgboost that referenced this pull request Jan 3, 2026
trivialfis added a commit that referenced this pull request Jan 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Incompatibility with sklearn 1.8.0: _estimator_type undefined

4 participants