Repository navigation
Conversation
|
Yes, exactly, I will push the updates on the metadata routing auto requests to this branch. Tagging @lorentzenchr to go over and verify the Linear models section. I think there were not a lot of new things on the callbacks side this release. We could leave it out and prepare it for 1.11. |
|
@jeremiedbb / @FrancoisPgm, do you want to add something for the callbacks? |
|
Some high level feeback: Less is more, I would remove callbacks, iterative imputer and maybe also array api. If we keep array api, we could also mention our plan to keep all array attributes as numpy array, which simplifies reasoning about it a lot. What to do with the LR C->alpha change? Usually, we don’t list deprecations in the highlights. |
The changes in this release regarding callbacks are almost exclusively under the hood plumbing improvements, I don't see anything meaningful to add. |
|
@virchan 2 questions
|
StefanieSenger
left a comment
There was a problem hiding this comment.
I have a few minor comments, but overall this looks good to me. Already approving to not be a blocker.
Thanks for taking care of this, @virchan! 🫶
Historically, we've merged the release highlights one day before the release. Therefore, I'm aiming to have this PR merged on November 29. Direct commits are always welcome! I should have mentioned this earlier 😅. |
|
|
||
| To install the latest version (with pip):: | ||
|
|
||
| pip install --upgrade scikit-learn |
There was a problem hiding this comment.
I wonder: does this also upgrade joblib and threadpoolctl? Recently, I merged a PR to use a feature of threadpoolctl, it was an old feature but it had been never used and it was buggy, it's fixed in the latest threadpoolctl.
@ogrisel : WDYT? Maybe we should put 3.8 as the min requirement for threadpoolctl.
There was a problem hiding this comment.
If users wants a bug fix in threadpoolctl then they should update threadpoolctl. Bumping the minimum dependency of scikit-learn feels too aggressive. You would force people that don't care about the bug in threadpoolctl to update and there doesn't seem to be a good enough reason to.
tl;dr with recent pip versions pip install -U scikit-learn does not update threadpoolctl.
content spout out by an LLM that matches my vague recollection of things
(so it must be right, right 😜)
pip install -U bla upgrades bla, but it doesn’t automatically upgrade every dependency to its latest version. By default, pip uses only-if-needed: it upgrades a dependency only if the newly selected version of bla requires a version that the installed dependency doesn’t satisfy. This has been the default since pip 10.0.
To also upgrade dependencies that already satisfy bla’s requirements, use:
pip install -U --upgrade-strategy eager blaSo your recollection is partly right: older pip versions defaulted to eager dependency upgrades; newer ones default to the more conservative behavior.
There was a problem hiding this comment.
Well, I don't think calling it a bug in threadpooctl is accurate: the fix is in threadpoolctl yes, but the bug is only visible on scikit-learn (and only since #35180 was merged, as it started using an option of threadpoolctl that was existing for a long time but was never used and was buggy, despite being useful nice once fixed).
For me, silently shipping a tremendous perf regression is way more aggressive than forcing an upgrade on a python-only package 99% of users don't know about 😅
So either we fix scikit-learn before the release (not hard, we can do it, just sad to revert), or we bump min version of threadpoolctl (which I honestly think does more good than harm).
There was a problem hiding this comment.
What about adding some logic in scikit-learn where we use sequential_blas_under_openmp only for threadpoolctl >= 3.7?
The performance bug likely affects a tiny fraction of the users 🔮, the minimum version bump affects all of them.
In general, as a library putting strong constraints on dependencies is to be avoided, because you never know some other packages package may have separate constraints and the user ends up with mutually exclusive constraints. I don't think this is likely to happen with threadpoolctl but you never know.
There was a problem hiding this comment.
The performance bug likely affects a tiny fraction of the users 🔮
I don't think this is likely to happen with threadpoolctl but you never know.
I think both statements are 🔮-ish and I'll try to find ways to assess them a bit more objectively (might not be easy but I have some ideas 😉)
What about adding some logic in scikit-learn where we use sequential_blas_under_openmp only for threadpoolctl >= 3.7?
I think the workaround I have in mind is prettier than that (it avoids branching). But yeah in both case, it's not hard to make a workaround. So why am I arguing so much here you might ask ^^
As someone working on performance and running benchmarks all day long, the support of a range of versions on loky/threadpoolctl/joblib scares the hell out of me: I can't test all combinations (and given how pip install -U works, many are likely to exist somewhere), and each one represent a fairly important performance risk (especially with the current & future work around free-threading).
So I think the tradeoff that pushes us to be conservative on those libraires might be worth being re-considered (once again, some data on what other packages do will help, I'll try to get that).
cc @itamarst: I'm interested to hear your opinion here, you might be the one understanding those performance risks the best. Maybe I'm too scared because of this bad surprise I had with the sequential_blas_under_openmp bug.
There was a problem hiding this comment.
Sorry, missed this.
Perhaps scikit-learn should grow a concept of recommended minimum version, as opposed to required minimum version? And then warn on import if the version is supported but not recommended?
There was a problem hiding this comment.
For this release, PR #35547 will do. And for the next one, let's think again once we start changing scikit-learn to benefit from your work on threadpoolctl & joblib, it might be clearer by then.
(ah I can't resolve the thread)
|
RFC about a random idea: if the HGB PR and the Array API Cholesky Ridge PR gets merged (which is reasonably likely, as both already have one approval), I could write up a fairly impressive "performance update" for the 1.10:
And maybe other stuffs but I don't remember, I'll look at my notes and ask an agent to parse my github activity ^^ WDYT? Separate document or integrated in the release highlights? |
|
How to others think about removing the "is no longer experimental" section? |
|
I've taken the liberty of removing the |
If it is a real measurable boost for users, then yes. Meanwhile there is another HGBT PR #35526. If that gets merged, the HGBT improvement is a good story of up to 30-40% (higgs with 100 trees from ~62s to ~44s on my laptop). |
| # %% | ||
| # Performance update | ||
| # ------------------ | ||
| # TODO |
There was a problem hiding this comment.
Here is a proposal for the performance update.
| # TODO | |
| # Many estimators are faster in this release, without any change in user code. Some | |
| # improvements speed up a single core, which helps most when many models are fitted | |
| # in parallel, e.g. in a hyper-parameter search with `n_jobs=-1`. Others let a single | |
| # fit benefit more from all the cores of the machine. | |
| # | |
| # :class:`~ensemble.HistGradientBoostingClassifier` and | |
| # :class:`~ensemble.HistGradientBoostingRegressor` got most of the attention. Fit | |
| # times below are in seconds, with scikit-learn 1.9.1 → 1.10: | |
| # | |
| # - Binning the data and building the histograms are faster: on a single thread, a | |
| # fit is 10 to 50% faster depending on the dataset, with the largest gains on | |
| # categorical or binary features. | |
| # - Fitting with `sample_weight` on fewer than 200,000 samples no longer spends most | |
| # of its time in binning: 5.2 → 0.9 for 100,000 x 30 samples on a single thread. | |
| # - The number of threads is now chosen from the size of the data instead of always | |
| # using all the cores. This matters most with the conda-forge packages, whose | |
| # OpenMP runtime lets idle threads sleep on recent desktop and laptop CPUs: on a | |
| # desktop CPU with 24 cores, the covertype dataset (581,012 x 12) goes from 187 to | |
| # 7.9 (6.6 → 4.2 with the wheels from PyPI). | |
| # - It also helps on machines with many cores: on a server with 2 x 86 cores, | |
| # covertype goes from 59 to 19, and the SUSY dataset (4,500,000 x 18) from 22 to | |
| # 11, even if a single fit is still not the best way to use such a machine. | |
| # | |
| # Other notable speed-ups, on the same desktop CPU: | |
| # | |
| # - The k-means++ initialization of :class:`~cluster.KMeans` and | |
| # :class:`~cluster.MiniBatchKMeans` now runs in parallel: a `KMeans` fit on | |
| # 1,000,000 x 50 samples with 100 clusters goes from 6.3 to 1.2 seconds with 24 | |
| # threads. | |
| # - Queries on :class:`~neighbors.KDTree` and :class:`~neighbors.BallTree` now scale | |
| # with the number of threads: a :class:`~neighbors.KNeighborsClassifier` prediction | |
| # goes from 7.3 to 0.34 seconds with 24 threads (6.0 to 4.0 with one). | |
| # - :class:`~preprocessing.OneHotEncoder`, :class:`~preprocessing.OrdinalEncoder` and | |
| # :class:`~preprocessing.TargetEncoder` are up to 2 times faster on integer | |
| # categories, and up to 4 times faster on strings with `min_frequency`. | |
| # - With :ref:`array API support <array_api>` enabled, :class:`~linear_model.Ridge` | |
| # now uses its `"cholesky"` solver on GPU arrays. Fitting 200,000 x 5,000 float32 | |
| # samples with PyTorch takes 0.9 seconds on the Intel Arc B580 GPU of this machine, | |
| # against 4.3 seconds with NumPy on its CPU (1.1 against 13.5 seconds for an NVIDIA | |
| # L4 GPU and the 8 vCPUs of its cloud instance). | |
| # - :class:`~linear_model.ElasticNetCV` and :class:`~linear_model.LassoCV` are up to | |
| # 4 times faster on sparse data, and :class:`~isotonic.IsotonicRegression` is 3 | |
| # times faster to fit. | |
| # | |
| # See the "Efficiency" entries of the :ref:`release notes <release_notes_1_10>` for | |
| # the full list. |

Here are some changes that Claude and I found worth-mentioning. The current goal is to have this merged on November 29. Direct commits are always welcome.
LogisticRegressionAPI change, GLM, and the new solvers)IterativeImputergraduates from experimental (remove?)array APIPerformance updateCallbacksEdit: updated PR description to reflect #35333 (comment).