Skip to content

Fixes for sklearn 1.7 pre-release support #2451

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

Merged
merged 4 commits into from
Jun 9, 2025

Conversation

Alexsandruss
Copy link
Contributor

@Alexsandruss Alexsandruss commented Apr 25, 2025

Description

Fixes for sklearn 1.7 pre-release support:

  • Remove usage of deleted sklearn.utils._joblib module in pairwise distances
  • Change internal TSNE parameter name to max_iter for sklearn>=1.7
  • Fix onedal.utils._array_api._is_numpy_namespace to support new sklearn's xp name
  • Temporary fix probabilities not in [0, 1] interval computed by ensemble models on sklearnex side (sklearn started enforcing upper interval border in estimator check).

Note: this PR fixes critical failures, there are still sklearnex and sklearn test failures.


PR should start as a draft, then move to ready for review state after CI is passed and all applicable checkboxes are closed.
This approach ensures that reviewers don't spend extra time asking for regular requirements.

You can remove a checkbox as not applicable only if it doesn't relate to this PR in any way.
For example, PR with docs update doesn't require checkboxes for performance while PR with any change in actual code should have checkboxes and justify how this code change is expected to affect performance (or justification should be self-evident).

Checklist to comply with before moving PR from draft:

PR completeness and readability

  • I have reviewed my changes thoroughly before submitting this pull request.
  • I have commented my code, particularly in hard-to-understand areas.
  • I have updated the documentation to reflect the changes or created a separate PR with update and provided its number in the description, if necessary.
  • Git commit message contains an appropriate signed-off-by string (see CONTRIBUTING.md for details).
  • I have added a respective label(s) to PR if I have a permission for that.
  • I have resolved any merge conflicts that might occur with the base branch.

Testing

  • I have run it locally and tested the changes extensively.
  • All CI jobs are green or I have provided justification why they aren't.
  • I have extended testing suite if new functionality was introduced in this PR.

Performance

N/A.

@Alexsandruss Alexsandruss added bug Something isn't working sklearn-patch sklearn patching labels Apr 25, 2025
@Alexsandruss
Copy link
Contributor Author

/azp run Nightly

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@Alexsandruss
Copy link
Contributor Author

/intelci: run

Copy link

codecov bot commented Apr 25, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Flag Coverage Δ
azure 79.91% <100.00%> (?)
github 71.62% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
onedal/ensemble/forest.py 73.49% <100.00%> (+0.09%) ⬆️
onedal/utils/_array_api.py 84.78% <100.00%> (ø)

... and 41 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@Alexsandruss
Copy link
Contributor Author

/azp run Nightly

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@Alexsandruss Alexsandruss marked this pull request as ready for review April 27, 2025 22:36
"numpy",
"array_api_compat.numpy",
"numpy.array_api",
"sklearn.externals.array_api_compat.numpy",
Copy link
Contributor

Choose a reason for hiding this comment

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

How does one end up with this namespace for an array object? Could it somehow happen that it'd end up with a different name like <package that imports sklearn>.sklearn.externals.array_api_compat.numpy ?

Copy link
Contributor

Choose a reason for hiding this comment

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

I think you are getting at the core issue here, which is that this function is fragile. We should think about how to make it more robust.

@icfaust
Copy link
Contributor

icfaust commented Jun 5, 2025

Please merge main into the PR and rerun CI for me to review @Alexsandruss

Copy link
Contributor

@icfaust icfaust left a comment

Choose a reason for hiding this comment

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

Please share the forest fix ticket to me before merging this PR.

@Alexsandruss Alexsandruss merged commit 95c73bd into uxlfoundation:main Jun 9, 2025
27 checks passed
@Alexsandruss
Copy link
Contributor Author

@mergify backport rls/2025.6.0-rls

Copy link

mergify bot commented Jun 10, 2025

backport rls/2025.6.0-rls

✅ Backports have been created

mergify bot pushed a commit that referenced this pull request Jun 10, 2025
* Fixes for sklearn 1.7 pre-release support

* Fix ensemble probabilities interval

* Change scaling method to `clip`

---------

Co-authored-by: icfaust <icfaust@gmail.com>
(cherry picked from commit 95c73bd)
@Alexsandruss
Copy link
Contributor Author

@mergify backport rls/2025.5.0-rls

Copy link

mergify bot commented Jun 10, 2025

backport rls/2025.5.0-rls

✅ Backports have been created

mergify bot pushed a commit that referenced this pull request Jun 10, 2025
* Fixes for sklearn 1.7 pre-release support

* Fix ensemble probabilities interval

* Change scaling method to `clip`

---------

Co-authored-by: icfaust <icfaust@gmail.com>
(cherry picked from commit 95c73bd)
napetrov pushed a commit that referenced this pull request Jun 10, 2025
* Fixes for sklearn 1.7 pre-release support

* Fix ensemble probabilities interval

* Change scaling method to `clip`

---------


(cherry picked from commit 95c73bd)

Co-authored-by: Alexander Andreev <alexander.andreev@intel.com>
Co-authored-by: icfaust <icfaust@gmail.com>
david-cortes-intel pushed a commit to david-cortes-intel/scikit-learn-intelex that referenced this pull request Jun 11, 2025
* Fixes for sklearn 1.7 pre-release support

* Fix ensemble probabilities interval

* Change scaling method to `clip`

---------

Co-authored-by: icfaust <icfaust@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working sklearn-patch sklearn patching
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants