Version 1.10#
Legend for changelogs
Major Feature something big that you couldn’t do before.
Feature something that you couldn’t do before.
Efficiency an existing feature now may not require as much computation or memory.
Enhancement a miscellaneous minor improvement.
Fix something that previously didn’t work as documented – or according to reasonable expectations – should now work.
API Change you will need to change your code to have the same effect in the future; or a feature will be removed in the future.
Version 1.10.dev0#
November 2026
Changed models#
preprocessing.QuantileTransformerandpreprocessing.quantile_transformnow estimate quantiles with theaveraged_inverted_cdfmethod and no longer capn_quantilesatn_samples. Dense subsampling is also done with replacement. These changes affectquantiles_even whensample_weightis not passed. By Karassay Raushanbek and Shruti Nath. #32761ensemble.HistGradientBoostingClassifierandensemble.HistGradientBoostingRegressornow draw the subset of features considered at each split differently whenmax_features < 1.0. For a fixedrandom_state, the selected features, and hence the fitted trees, may differ from previous versions. By Arthur Lacote. #34786inspection.partial_dependenceandinspection.PartialDependenceDisplaynow usenumpy.nanquantile’s linear interpolation instead of the (unmaintained)scipy.stats.mstats.mquantiles’s Cunnane interpolation to compute the grid of values and deciles fromX. This may slightly shift the computed grid values and displayed deciles.np.nanvalues in a numerical column are now ignored (instead of being sorted last in the quantile calculation and hence possibly affecting the result depending on the requested percentiles). By Arthur Lacote. #34928
Changes impacting many modules#
Efficiency Hot-loop NaN checks in
sklearn.treeandsklearn.ensemble(histogram gradient boosting) now use a scikit-learn-local, always-inlinedisnanhelper instead oflibc.math.isnan(), avoiding a non-inlined libm call on platforms/libc versions where the compiler cannot inline it (notably affecting fit performance ofensemble.ExtraTreesRegressorandensemble.ExtraTreesClassifieron some conda-forge builds). By Arthur Lacote. #34876Fix
inspection.partial_dependenceno longer returns incorrect values for target features that are categorical fortree.DecisionTreeRegressor,ensemble.RandomForestRegressor,ensemble.HistGradientBoostingRegressororensemble.HistGradientBoostingClassifier.method="auto"now uses the'brute'method for such features, andmethod="recursion"raises aNotImplementedError. By Arthur Lacote. #34554Fix The k-nearest neighbors search (used for instance by
neighbors.KNeighborsClassifier,neighbors.NearestNeighborsandmetrics.pairwise_distances_argmin) no longer runs on a single thread with threadpoolctl 3.7 and OpenBLAS’s OpenMP threading layer. By Arthur Lacote. #35180Fix
multioutput.MultiOutputRegressor.partial_fitandneural_network.BernoulliRBM.partial_fitnow returnself, as their docstrings state, instead ofNone. By @lau0708. #35350
Support for Array API#
Additional estimators and functions have been updated to include support for all Array API compliant inputs.
See Array API support (experimental) for more details.
Feature
sklearn.metrics.coverage_errornow supports array API compatible inputs. By Josef Affourtit. #32626Feature
sklearn.metrics.roc_auc_scoreandsklearn.metrics.aucnow support array API-compatible inputs. By Virgil Chan. #33200Feature
covariance.LedoitWolfnow supports array API compatible inputs. By Tim Head #33573Feature
covariance.OASnow supports array API compatible inputs. By Bruno Aristimunha #33600Feature
linear_model.LogisticRegressionCVnow supports array API compatible inputs withsolver="lbfgs"andsolver="newton-cg"and when the underlying scoring function is also compatible with the array API. By Omar Salman and Christian Lorentzen. #33906Feature
sklearn.metrics.matthews_corrcoefnow supports array API compatible inputs. By Mohamad Fazeli. #34423Feature
sklearn.metrics.cluster.contingency_matrixnow supports array API compatible inputs. By Yaroslav Korobko and Omar Salman. #34785Feature
linear_model.Ridgeandlinear_model.RidgeClassifiernow supportsolver="cholesky"with array API compatible inputs.solver="auto"now resolves to"cholesky"for these inputs, like for NumPy inputs, instead of"svd"with a warning. By Arthur Lacote. #35418Efficiency
metrics.pairwise.euclidean_distances,metrics.pairwise.cosine_distancesandmetrics.pairwise_distancesare faster when computing the distances between the rows of a single non-NumPy array API input: the diagonal of the result is now set with one operation instead of one per sample. By Arthur Lacote. #35457Enhancement Add support for array inputs from mixed namespaces and devices for:
sklearn.metrics.det_curve,sklearn.metrics.roc_curve,sklearn.metrics.zero_one_loss,sklearn.metrics.jaccard_score,sklearn.metrics.balanced_accuracy_score,sklearn.metrics.cohen_kappa_score. By Lucy Liu. #34442Enhancement
linear_model.LogisticRegressionandlinear_model.PoissonRegressornow support array API compatible inputs withsolver="newton-cg". By Christian Lorentzen and Omar Salman. #34412 and #35050Fix
model_selection.GridSearchCV,model_selection.RandomizedSearchCV,model_selection.cross_validateandmodel_selection.cross_val_scoreno longer forceyintoX’s array namespace during cross-validation. Namespace and device handling ofyis delegated to the wrapped estimator, so an array APIXcan be combined with a NumPyy, including a NumPy stringywhich cannot be held by array API namespaces. By Tim Head. #33633Fix Fixed
metrics.median_absolute_errorto handle integer inputs when the input array namespace does not support integer inputs to itsquantilefunction (e.g., PyTorch). By Lucy Liu. #33778Fix Fixes support when
average="samples"andsample_weightis an array from a namespace or device different fromy_pred, for:sklearn.metrics.precision_recall_fscore_support,sklearn.metrics.recall,sklearn.metrics.precision,sklearn.metrics.f1_score,sklearn.metrics.fbeta_score. Also fixes several bugs in array API compliance ofsklearn.metrics.roc_curve. By Lucy Liu. #34442Fix
discriminant_analysis.LinearDiscriminantAnalysisnow supports array API inputs whereyis from a different namespace or device thanX, including string labels. By Kiyarash Fazeli. #34475Fix
linear_model.PoissonRegressornow acceptsyandsample_weightfrom a different array API namespace or device thanX. By Amineh Dadsetan. #34480Fix Fixed classification metrics to accept pandas labels when array API dispatch is enabled and predictions are from a different array API namespace or device. By Olivier Grisel. #34779
Fix Fixed
metrics.d2_log_loss_scoreto compute the null model with the dtype ofy_proba. It could use float32 for float64 inputs (e.g., with PyTorch), or float64 for float32 inputs with NumPy, which slightly changed the score. By Arthur Lacote. #35322Fix
preprocessing.MaxAbsScalerandpreprocessing.LabelBinarizer(withsparse_output=False) now set thearray_api_supportestimator tag. Both already supported array API inputs, as documented in the user guide, but their tags reported no support. By Tim Head. #35479
Metadata routing#
Refer to the Metadata Routing User Guide for more details.
Feature Added support for auto-requesting metadata through
set_config(enable_metadata_auto_requests=True). This enables automatic routing of common metadata likesample_weight, orX_val. Consumers (estimators, scorers, and CV splitters) and consuming routers can now define which metadata requests to set automatically via theadd_auto_requestmethod, which complements the existing class-level defaults set through__metadata_request__*attributes. Refer to Default and Auto-Requested Metadata for more details. By Adrin Jalali and Stefanie Senger. #31413Feature
HistGradientBoostingClassifierandHistGradientBoostingRegressorauto-requestX_val,y_valandsample_weight_valwhen metadata routing and auto-requests are enabled viaset_config. By Stefanie Senger. #34957Feature scikit-learn estimators that inherit from
BaseEstimatornow auto-requestsample_weighton methods that accept it when metadata routing and auto-requests are enabled viaset_config. This includes consuming routers that expose those methods viaadd_self_request(for example CV estimators and other meta-estimators that consumesample_weightinfitand/orscore). Third-party estimators can opt in withAutoRequestMixin. By Stefanie Senger. #34966Feature
BaggingClassifier,BaggingRegressor,IsolationForestandOutputCodeClassifiernow expose their ownsample_weightconsumption viaadd_self_requestand auto-requestsample_weighton their methods (fitand / orscore) when metadata routing and auto-requests are enabled viaset_config. By Stefanie Senger. #35095Feature Scorers created with
make_scorerandget_scorerauto-requestsample_weightwhen the underlying metric accepts it and metadata routing and auto-requests are enabled viaset_config. By Stefanie Senger. #35099
Callbacks#
Efficiency
callback.CallbackContextobjects no longer hold references to their child contexts. Pickling a context no longer serializes the whole callback context tree, which removes a large overhead when estimators with callbacks are fitted withn_jobs > 1. By François Paugam. #35270Fix Fixed a leak of file descriptors and background threads in
callback.ScoringMonitorandcallback.ProgressBaracross parallelfitcalls (n_jobs > 1), as well as crashes and hangs under nested process and thread parallelism (e.g.model_selection.cross_validatewrappingmodel_selection.GridSearchCVwithn_jobs > 1). By Jérémie du Boisberranger and Olivier Grisel. #34856 and #34870API Change In
callback.ScoringMonitor, the option to providescoring=Noneto have the default scorer of the estimator has been removed. By François Paugam. #34590API Change The
__iter__method ofcallback.CallbackContext, which yielded the context and all its descendants in pre-order, has been removed. Callback contexts no longer hold references to their children. By François Paugam. #35270
sklearn.calibration#
Feature
calibration.calibration_curve,calibration.CalibrationDisplay.from_estimator, andcalibration.CalibrationDisplay.from_predictionsnow supportn_bins="cube_root". This option sets the number of bins toceil(n_samples**(1/3)). By Zeyu Sun #33856Fix
calibration.CalibratedClassifierCVwithmethod="sigmoid"now converts predict_proba outputs to logits (log(p/(1-p))) before calibration instead of passing probabilities directly to the calibrator. Formethod="temperature", predict_proba outputs are converted to multinomial logits. Estimators passed as parameterestimatortoCalibratedClassifierCVthat only expose decision_function are unaffected. Calibration now prefers predict_proba over decision_function when both are available. By Olivier Grisel and Antoine Baker. #34313Fix
calibration.CalibratedClassifierCVwithmethod="temperature"now gives correct probabilities when the class labels are numbers other than0, ..., n_classes - 1, for example{-1, 1}. Previously the fitted temperature was wrong, without any error or warning; predicted labels were not affected. With array API inputs, predict_proba now returns the dtype of the calibrated probabilities instead of the default floating point dtype of the array namespace. By Tim Head. #35478API Change
calibration.calibration_curve,calibration.CalibrationDisplay.from_estimator, andcalibration.CalibrationDisplay.from_predictionswill change the defaultstrategyto'quantile', starting from version 1.12. By Antoine Baker #33908API Change
calibration.calibration_curve,calibration.CalibrationDisplay.from_estimator, andcalibration.CalibrationDisplay.from_predictionswill change the defaultn_binsfrom5to"cube_root", starting from version 1.12. By Antoine Baker. #34326API Change In
calibration.CalibrationDisplaytheestimator_nameparameter is deprecated in favour ofnameand will be removed in 1.12. By Anne Beyer. #35316API Change The
**kwargsparameter ofcalibration.CalibrationDisplay.plot,calibration.CalibrationDisplay.from_estimatorandcalibration.CalibrationDisplay.from_predictionsis deprecated in favour ofcurve_kwargsand will be removed in 1.12. By Anne Beyer. #35491
sklearn.cluster#
Efficiency
cluster.AgglomerativeClusteringandcluster.FeatureAgglomerationwithlinkage="single", as well ascluster.HDBSCAN, are now faster for inputs that produce deep union-find trees. Restored path compression avoids quadratic time when constructing the single-linkage hierarchy. By Chris Boseak. #34872Efficiency The k-means++ initialization of
cluster.KMeans,cluster.MiniBatchKMeansandcluster.kmeans_plusplusis now much faster, in particular with many threads. For a givenrandom_state, the selected centers are different than in previous versions. By Arthur Lacote. #35140Efficiency
cluster.KMeansandcluster.k_meansare now faster and use half as much peak memory on dense data: the tolerance is computed without an extra pass overX.cluster.BisectingKMeansalso skips this pass. By Arthur Lacote. #35311
sklearn.datasets#
Fix
datasets.fetch_openmlwithparser="pandas"no longer raises aTypeErrorwhen a nominal column’s values are inferred by pandas as numeric or boolean categories instead of strings. By Dea María Léon. #34902
sklearn.discriminant_analysis#
Efficiency
discriminant_analysis.LinearDiscriminantAnalysisis faster to fit: the target is ordinal-encoded once infitand the number of classes is passed down to the internal helpers, removing a redundant pass over the target to recompute the unique class labels. Computing the class means is up to 1.4x faster for large numbers of samples and classes. By Kiyarash Fazeli. #34475
sklearn.ensemble#
Major Feature
ensemble.RandomForestClassifier,ensemble.RandomForestRegressor,ensemble.ExtraTreesClassifier, andensemble.ExtraTreesRegressornow accept thecategorical_featuresparameter, including"from_dtype". The default remainsNone."from_dtype"will become the default in version 1.13. Random forests support binary classification and single-output regression with up to 255 categories per feature. Extra trees support up to2**24 - 1categories per feature, including multi-class and multi-output targets.warm_startis not supported together with categorical features. By Adam Li. #34832Efficiency The terminal-node update step (a.k.a. line search step) of fitting
sklearn.ensemble.GradientBoostingClassifierwas optimized. This mainly benefits deeper trees, which are not the primary use case for gradient boosting but can appear in grid searches. For very deep trees, this can speed up training by up to a factor of 20. By Arthur Lacote #32911Efficiency Fitting in
sklearn.ensemble.HistGradientBoostingClassifierandsklearn.ensemble.HistGradientBoostingRegressorwas optimized to be faster, by speeding up assignment of bins. By Itamar Turner-Trauring. #34194Efficiency Improved the performance of binning in
ensemble.HistGradientBoostingClassifierandensemble.HistGradientBoostingRegressor. Fitting with sample weights could be slow for datasets with fewer than 200,000 samples; this is now fixed. Binning without sample weights was also optimized. By Arthur Lacote. #34248Efficiency Prediction in
sklearn.ensemble.HistGradientBoostingClassifierandsklearn.ensemble.HistGradientBoostingRegressoris faster when using categoricals via parametercategorical_features. By Itamar Turner-Trauring. #34486Efficiency Training
sklearn.ensemble.RandomForestClassifierandsklearn.ensemble.RandomForestRegressoron sparse data is now faster. By Itamar Turner-Trauring. #34586Efficiency Parallelism in
sklearn.ensemble.BaggingClassifierandsklearn.ensemble.BaggingRegressornow uses threads in some cases where this is faster than the default process pool. By Itamar Turner-Trauring #35044Efficiency Fitting
ensemble.HistGradientBoostingClassifierandensemble.HistGradientBoostingRegressorwas speedup by up to about 10% by avoiding memory copies of gradients and hessians. By Christian Lorentzen. #35386Efficiency Fitting
ensemble.HistGradientBoostingClassifierandensemble.HistGradientBoostingRegressoris faster for data with features that have few or unevenly populated bins, e.g. binary features or categorical features with a few very frequent categories. For instance, fit time is reduced by about 20% on the covertype dataset. By Christian Lorentzen. #35441Fix
ensemble.HistGradientBoostingRegressorandensemble.HistGradientBoostingClassifiernow correctly enable early stopping whenearly_stopping="auto"and explicit validation data is passed tofit. By @RugvedBane. #35176Fix Fixed a regression in
ensemble.HistGradientBoostingClassifierandensemble.HistGradientBoostingRegressorwhere fitting failed when a feature had only missing values (or only zero-weighted non-missing values). By Arthur Lacote. #35216API Change The
sklearn.experimental.enable_hist_gradient_boostingmodule is deprecated and will be removed in 1.12. It is no longer needed sinceensemble.HistGradientBoostingClassifierandensemble.HistGradientBoostingRegressorare stable and can be imported normally fromsklearn.ensemble. By Guillaume Lemaitre. #34236
sklearn.feature_selection#
Enhancement
feature_selection.RFEandfeature_selection.RFECVnow preserve DataFrame inputs and column names during fitting and elimination. By @Kaynup. #34789Fix Feature selectors such as
feature_selection.SelectKBestnow correctly reject non-finite values (infinity, and NaN unless allowed) intransformwhen usingset_output(transform="pandas"). By Abhimanyu Singh Shekhawat. #34513
sklearn.frozen#
Fix
frozen.FrozenEstimator.set_paramsnow returnsself, likebase.BaseEstimator.set_params, instead ofNone. By Yi-111-a. #35346
sklearn.gaussian_process#
Efficiency
gaussian_process.GaussianProcessRegressornow performs the hyperparameter search in parallel usingjoblib. By Michelle Laurenti. #34547
sklearn.impute#
API Change
impute.IterativeImputeris no longer experimental. It can now be imported directly withfrom sklearn.impute import IterativeImputer, and importingsklearn.experimental.enable_iterative_imputeris no longer required (doing so now raises a warning and is a no-op). It also no longer raises aexceptions.ConvergenceWarningwhenmax_iteris reached without meeting thetolstopping criterion, as non-convergence of the round-robin imputation is expected. The User Guide now documents why the imputed values are not guaranteed to converge and why investing in better imputation often yields diminishing returns for prediction. By Guillaume Lemaitre. #34214
sklearn.inspection#
API Change The parameter
multiclass_colorswas deprecated in favour oftarget_colorsininspection.DecisionBoundaryDisplay. The attributemulticlass_colors_was also renamed totarget_colors_. Now they can be used for binary problems as well without causing confusion (which will be added in a follow-up PR). By Anne Beyer. #34092
sklearn.isotonic#
Efficiency
isotonic.IsotonicRegressionis now faster to fit by up to a factor of 3 or more on large data. This is made possible by using numpy’s fast sorting functions and only (arg-) sortingXinstead of anp.lexsortonXandy. By Arthur Lacote. #35422
sklearn.linear_model#
Major Feature The generalized linear models (GLM)
linear_model.GammaRegressor,linear_model.PoissonRegressorandlinear_model.TweedieRegressorare now able to fit L1 (Lasso) and Elastic-Net penalties with the new parameterl1_ratiotogether with the 2 new solvers"newton-cd"and"newton-cd-gram". These new solvers are also available forlinear_model.LogisticRegression. They are based on the Newton solver infrastructure introduced for"newton-cholesky"and take advantage of the already available and fast (e.g. via gap safe screening rules) coordinate descent solvers ofElasticNet."newton-cd-gram"constructs the full Hessian (gram) matrix and then usesElasticNet(precompute=True)as the inner solver. It is a good choice forn_samples >> n_features(at least wheneverl1_ratio > 0)."newton-cd"avoids constructing the full Hessian matrix, but formulates the minimization problem for the inner solver as a penalized least squares problem (which amounts to taking the square root of the Hessian; this is even done with great care for multiclass/multinomial logistic regression using an analytic LDL decomposition of the multinomial covariance matrix per sample) and then usesElasticNet(precompute=False)on it. It is a good choice forn_features > n_samples(at least wheneverl1_ratio > 0).By Christian Lorentzen. #34561, #34377, #34523. #34681
Efficiency All solvers of
linear_model.LogisticRegressionCVare now faster on free-threaded Python when using parallelism. The only exceptions are"sag"and"saga"solvers, which will continue to run at the same speed. By Itamar Turner-Trauring. #34659Enhancement
linear_model.PoissonRegressor,linear_model.GammaRegressorandlinear_model.TweedieRegressorgot a new solver:solver="newton-cg". This is the same Newton conjugate gradient solver, a.k.a. truncated Newton, that is already available withlinear_model.LogisticRegression. By Christian Lorentzen. #33759Enhancement
linear_model.ElasticNetCV,linear_model.LassoCVandlinear_model.MultiTaskElasticNetCVas well aslinear_model.enet_pathandlinear_model.lasso_pathare now faster. The (relative) speed-up is larger for lower convergence requirements (larger values oftol) and is achieved by avoiding recalculating the residuals and column norms ofXfor each penaltyalphaalong the path. By Christian Lorentzen. #34572Enhancement
linear_model.ElasticNetCV,linear_model.LassoCVandlinear_model.MultiTaskElasticNetCVnow avoid prematurely convertingXto an F-contiguous array or a sparse CSC array because the inner cross validation takes subsamples ofXwhich then need the same conversion again, anyway. This avoids memory copies ofX. By Christian Lorentzen. #34613Fix The
solver="newton-cg"forlinear_model.LogisticRegression,linear_model.PoissonRegressorand other GLMs is now more robust. Many convergence issues have been fixed, e.g. for certain ill-conditioned problems with low regularization and nearly collinear features. In particular, it now handles small or negative curvature more robustly, based on the research of C.W. Royer, M.J. O’Neill and S.J. Wright (2018). By Christian Lorentzen. #34412Fix The solvers
"sag"and"saga"oflinear_model.LogisticRegression,linear_model.LogisticRegressionCV,linear_model.Ridgeandlinear_model.RidgeClassifiernow takesample_weightinto account for their step size. Before, large sample weights could lead to non-convergence or overflow errors and small sample weights to slow convergence. Fitted models are now invariant under a rescaling ofsample_weighttogether with the penalty. As a consequence, results of fits withsample_weightmay change. Fits withoutsample_weightare not affected. By Christian Lorentzen. #35417Fix The line search of the solvers
"newton-cholesky","newton-cd"and"newton-cd-gram"oflinear_model.LogisticRegression,linear_model.GammaRegressor,linear_model.PoissonRegressorandlinear_model.TweedieRegressornow uses the approximate Armijo condition of Hager & Zhang (2005) to accept steps for which the change of the loss is of the order of machine precision. It replaces the check on the sum of absolute gradients. Furthermore, if the line search fails, the lbfgs fallback now starts from the coefficients before the line search instead of the last rejected trial step. By Christian Lorentzen. #35489API Change The parameters
Coflinear_model.LogisticRegressionandCsoflinear_model.LogisticRegressionCVare deprecated and will be removed in version 1.14. There are new parametersalphaandalphasinstead with the following relationship:for
LogisticRegression:alpha = 1/Cfor
LogisticRegressionCV:alphas = Csfor integer values,alphas = 1/Csfor array-likes of float
They have the following default values:
alpha=1.0forLogisticRegression, meaning it is the same default asC=1.0.alphas=10forLogisticRegressionCV, meaning it is the same default asCs=10.
This means that the defaults result in the same models as before (up to floating point precision).
With this change the penalty parameter of most linear models is
alpha, the larger its value the stronger the penalty. For L2-penalties, the parametrization is similar tolinear_model.Ridgewhere the penalty gets weaker the larger the training dataset (by a factor of1/n_samples).For
linear_model.LogisticRegressionCV, also the attributesC_andCs_are deprecated. Use the new attributesalpha_andalphas_instead. By Christian Lorentzen. #32042API Change The
solver="liblinear"as well as its two related parametersdualandintercept_scaling, are deprecated forlinear_model.LogisticRegressionandlinear_model.LogisticRegressionCV. Instead, particularly for L1 and ElasticNet penalties, the newly introduced"newton-cd"and"newton-cd-gram"solvers are recommended replacements. Note also that liblinear is the only solver that does not support the multinomial loss for multiclass problems and we vendor a very old version of it. By Christian Lorentzen. #35067API Change For a better user experience the following estimators got a new option
solver="auto":The new option
"auto"is set as the default. The idea is to select a solver that works no matter whichl1_ratiois chosen. For pure L2-penalties or no penalty, the behavior stays unchanged and"lbfgs"is selected. Note that the selection of"auto"might change in future versions without deprecation.To record which solver was selected, the attribute
solver_was also added. By Christian Lorentzen. #35110API Change The parameter
use_legacy_attributesoflinear_model.LogisticRegressionCVis deprecated and will be removed in version 1.12. The default value changed from True to False. By Christian Lorentzen. #35120
sklearn.manifold#
Fix Fixed a segmentation fault in
manifold.TSNEwheninit="pca"is used with input data having zero variance (constant values), which now falls back to random initialization. By Nandan #32789Fix
manifold.SpectralEmbeddingandcluster.SpectralClusteringno longer raise aValueErrorabout 64-bit sparse indices when fitted underconfig_context(sparse_interface="sparray")with the defaulteigen_solver="arpack". By Adrin Jalali. #34965
sklearn.metrics#
Efficiency
metrics.pairwise.nan_euclidean_distancesis now several times faster on dense data, with a more moderate speed-up forimpute.KNNImputerand estimators usingmetric="nan_euclidean"such asneighbors.NearestNeighbors. By Roman Yurchak. #34277Enhancement
confusion_matrix_at_thresholds,roc_curve,precision_recall_curve,det_curve, androc_auc_scorenow use exact integer cumulative sums for unweighted inputs (sample_weight=None), preventing floating-point precision saturation onfloat32-only array API devices when processing datasets exceeding \(2^{24}\) samples. By Kaynup. #34817Fix Fixed
metrics.average_precision_scoreto handle list-typey_scorefor multiclass data. By Lucy Liu. #34083API Change The default value of the
averageparameter ofmetrics.precision_recall_fscore_supportwill change fromNoneto"binary"in version 1.12. By François Paugam. #34190API Change In
metrics.DetCurveDisplaytheestimator_nameparameter is deprecated in favour ofnameand will be removed in 1.12. The**kwargsparameter ofmetrics.DetCurveDisplay.plot,metrics.DetCurveDisplay.from_estimatorandmetrics.DetCurveDisplay.from_predictionsis also deprecated in favour ofcurve_kwargsand will be removed in 1.12. By @AnneBeyer. #34443
sklearn.mixture#
Efficiency
mixture.GaussianMixturewithcovariance_type="tied"is now faster, with the speed-up most visible for many components or high-dimensional data. By Roman Yurchak. #34277
sklearn.model_selection#
Enhancement
model_selection.permutation_test_scorenow raises aUserWarningwhen each group ingroupshas a single value ofy. Permuting within groups then leavesyunchanged, so the permutation test is not meaningful. By Dongjin Choi. #35345Fix
from sklearn.model_selection import *no longer raises anImportError. By Pranav Negi. #35042API Change
model_selection.HalvingGridSearchCVandmodel_selection.HalvingRandomSearchCVnow expose the cross-validation results of the last halving iteration incv_results_. The full per-iteration history is available in the newall_cv_results_attribute. By Guillaume Lemaitre. #34250
sklearn.neighbors#
Feature
neighbors.NeighborhoodComponentsAnalysisnow supports sparse input matrices forinitin['pca', 'random', 'identity']. By Arturo Amor. #34122Efficiency
neighbors.KNeighborsRegressor.predictis now faster for regression with many output targets. By Roman Yurchak. #34277
Efficiency
sklearn.neighbors.KNeighborsClassifieris now faster when running with multiple threads. The statistics returned fromsklearn.neighbors.BallTreeandsklearn.neighbors.KDTreeno longer reset on each query, and are no longer incorrect when the tree is used from multiple threads. By Itamar Turner-Trauring. #34187Efficiency
sklearn.neighbors.KNeighborsClassifieris now faster when fitting when used withsklearn.neighbors.BallTreeorsklearn.neighbors.KDTree. By Itamar Turner-Trauring. #34564Efficiency
sklearn.neighbors.KDTreeis now faster for most distance metrics, so for examplesklearn.neighbors.KNeighborsClassifierhas faster fitting and prediction when using kdtrees. By Itamar Turner-Trauring. #35045
API Change Getting statistics and number of calls from
sklearn.neighbors.BallTreeandsklearn.neighbors.KDTreeis deprecated. The relevant APIs will be removed in version 1.12. #34242
sklearn.neural_network#
Fix
neural_network.MLPRegressorno longer exposespartial_fitwhensolver="lbfgs", consistent withneural_network.MLPClassifier. By @cosimo17. #35137
sklearn.pipeline#
Fix The default value for the
transform_inputparameter ofpipeline.Pipelinewas changed fromNoneto("X_val",)so that the validation set, when passed to fit, is always transformed alongsideX, to prevent easy to miss mistakes. By Jérémie du Boisberranger. #34263
sklearn.preprocessing#
Efficiency Improved fit time of
preprocessing.OneHotEncoderandpreprocessing.OrdinalEncoderon object/string categorical features when category counts are needed, for instance withmin_frequencyormax_categories. By Itamar Turner-Trauring. #34386Efficiency
preprocessing.OneHotEncoder,preprocessing.OrdinalEncoder, andpreprocessing.TargetEncoderare now faster by using a Fortran-contiguous memory layout in their encoding paths. By Arthur Lacote. #34392Enhancement
preprocessing.QuantileTransformercan now handle sample weight values by subsampling using sample weights if subsampling is enabled or otherwise using a weighted percentile method. The default method of calculating percentiles for both weighted and unweighted cases is now fixed to “averaged_inverted_cdf”. Support is only implemented for dense X. By Karassay Raushanbek and Shruti Nath. #32761Fix A few edge cases with missing values and unique knot values in
preprocessing.SplineTransformerare now handled correctly. For instance, if a feature is constant, i.e., has only one unique value at fit time,transformnow always returns all zeros for that feature. By Christian Lorentzen. #33953Fix The warning raised by
preprocessing.OneHotEncodernow distinguishes columns where unknown categories are encoded as the infrequent category from columns where they are encoded as all zeros. By oathbreaker. #34861Fix
preprocessing.TargetEncoder.fit_transformno longer raises aKeyErrorwhen metadata routing is enabled andgroupsis not passed. By Erwan Le Pennec. #35185Fix
preprocessing.KBinsDiscretizerwithstrategy="quantile"orstrategy="kmeans"no longer merges the samples equal to the maximum into the previous bin when the last bin edges are tied. For instance, binary features are no longer transformed to a constant. Features with a range smaller than1e-8now get one bin instead of zero bins, which raised anIndexErrorbefore. By Arthur Lacote. #35368
sklearn.tree#
Major Feature
tree.DecisionTreeRegressor,tree.DecisionTreeClassifiernow have native support for categorical features for binary classification and single-output regression. All criteria are supported except for'absolute_error'. Categorical features can be specified with thecategorical_featuresparameter. Up to 256 categories per features are supported. By Adam Li, Arthur Lacote, Adrin Jalali and Christian Lorentzen #33354Major Feature
tree.DecisionTreeRegressor,tree.DecisionTreeClassifier,tree.ExtraTreeRegressor, andtree.ExtraTreeClassifiernow have native support for categorical features via thecategorical_featuresparameter. Decision trees support binary classification and single-output regression (all criteria except'absolute_error') with up to 256 categories per feature. Extra trees also support multi-class / multi-output targets with up to2**24 - 1categories via random hash splits. By Adam Li, Arthur Lacote, Adrin Jalali and Christian Lorentzen #33972Feature Added a
fill_colorsparameter totree.plot_treeandtree.export_graphvizto allow user-defined class colors when rendering filled decision trees. By Simon-Martin Schröder. #33810
sklearn.utils#
Fix The HTML representation of estimators is now keyboard accessible. The collapsible estimator boxes are built with native
<details>and<summary>elements, so they can be reached and toggled with a keyboard. They are announced as disclosure widgets by screen readers. The element with keyboard focus is now shown with a visible outline. By Dea María Léon. #34582Fix
utils.class_weight.compute_class_weightnow preserves numeric-looking string class labels when using dictionary class weights, fixing failures for estimators such as random forests withclass_weight="balanced". By Tony Bagnall. #34983Fix
utils.check_arraynow correctly handlesnarwhals.DataFramebacked by pandas containing extension dtypes without raising anAttributeError. By Direk Kakkar. #35405Fix
utils.check_arraywithcopy=Falseandforce_writeable=Truenow copies the read-only array that pandas Copy-on-Write returns for a DataFrame or Series, instead of making it writeable. Previously, an estimator withcopy=Falsecould overwrite the data of other DataFrames sharing memory with the input. Now, with Copy-on-Write enabled (pandas >= 3, or pandas 2 withpd.options.mode.copy_on_write = True), the input DataFrame or Series is no longer modified in place and a copy is always made. By Dea María Léon. #35469API Change
utils.estimator_checks.check_array_api_inputnow takesX_ns_and_deviceandother_ns_and_deviceinstead ofarray_namespaceanddevice_name, so that it is able to also cover inputs from mixed namespaces/devices.utils.estimator_checks.check_array_api_mixed_inputs, which was just a thin wrapper, is removed; the same check is still run byutils.estimator_checks.check_estimatorand can still be referred to as"check_array_api_mixed_inputs"inexpected_failed_checks. By Lucy Liu. #35484
Code and documentation contributors
Thanks to everyone who has contributed to the maintenance and improvement of the project since version 1.9, including:
TODO: update at the time of the release.