Version 1.7#
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.7.dev0#
March 2025
Changes impacting many modules#
Sparse update: As part of the SciPy change from spmatrix to sparray, all internal use of sparse now supports both sparray and spmatrix. All manipulations of sparse objects should work for either spmatrix or sparray. This is pass 1 of a migration toward sparray (see SciPy migration to sparray By Dan Schult #30858
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.utils.check_consistent_length
now supports Array API compatible inputs. By Stefanie Senger #29519Feature
sklearn.metrics.explained_variance_score
andsklearn.metrics.mean_pinball_loss
now support Array API compatible inputs. By Virgil Chan #29978Feature
sklearn.metrics.fbeta_score
,sklearn.metrics.precision_score
andsklearn.metrics.recall_score
now support Array API compatible inputs. By Omar Salman #30395Feature
sklearn.metrics.hamming_loss
now support Array API compatible inputs. By Thomas Li #30838array-api-compat and array-api-extra are now vendored within the scikit-learn source. Users of the experimental array API standard support no longer need to install array-api-compat in their environemnt. by Lucas Colley #30340
Metadata routing#
Refer to the Metadata Routing User Guide for more details.
Feature
ensemble.BaggingClassifier
andensemble.BaggingRegressor
now support metadata routing through theirpredict
,predict_proba
,predict_log_proba
anddecision_function
methods and pass**params
to the underlying estimators. By Stefanie Senger. #30833
sklearn.calibration
#
Fix
CalibratedClassifierCV
now raisesFutureWarning
instead ofUserWarning
when passingcv="prefit
”. By Olivier GriselCalibratedClassifierCV
withmethod="sigmoid"
no longer crashes when passingfloat64
-dtypedsample_weight
along with a base estimator that outputsfloat32
-dtyped predictions. By Olivier Grisel #30873
sklearn.covariance
#
Fix Support for
n_samples == n_features
insklearn.covariance.MinCovDet
has been restored. By Antony Lee. #30483
sklearn.datasets
#
Enhancement New parameter
return_X_y
added todatasets.make_classification
. The default value of the parameter does not change how the function behaves. By Success Moses and Adam Cooper #30196
sklearn.decomposition
#
Feature
DictionaryLearning
,SparseCoder
andMiniBatchDictionaryLearning
now have ainverse_transform
method. By Rémi Flamary #30443
sklearn.ensemble
#
Fix
ensemble.VotingClassifier
andensemble.VotingRegressor
validateestimators
to make sure it is a list of tuples. By Thomas Fan. #30649
sklearn.inspection
#
Enhancement Add
custom_values
parameter ininspection.partial_dependence
. It enables users to pass their own grid of values at which the partial dependence should be calculated. By Freddy A. Boulton and Stephen Pardy #26202Enhancement
inspection.DecisionBoundaryDisplay
now supports plotting all classes for multi-class problems whenresponse_method
is ‘decision_function’, ‘predict_proba’ or ‘auto’. By Lucy Liu #29797API Change
inspection.partial_dependence
does no longer accept integer dtype for numerical feature columns. Explicit conversion to floating point values is now required before calling this tool (and preferably even before fitting the model to inspect). By Olivier Grisel #30409
sklearn.linear_model
#
Fix
linear_model.LogisticRegression
andlinear_model.LogisticRegressionCV
now properly pass sample weights toutils.class_weight.compute_class_weight
when fit withclass_weight="balanced"
. By Shruti Nath and Olivier Grisel #30057- Fix Enhancement Added a new parameter
tol
to linear_model.LinearRegression
that determines the precision of the solutioncoef_
when fitting on sparse data. By Success Moses #30521
- Fix Enhancement Added a new parameter
- Fix The update and initialization of the hyperparameters now properly handle
sample weights in
linear_model.BayesianRidge
. By Antoine Baker. #30644
sklearn.metrics
#
Feature
metrics.brier_score_loss
implements the Brier score for multiclass classification problems and adds ascale_by_half
argument. This metric is notably useful to assess both sharpness and calibration of probabilistic classifiers. See the docstrings for more details. By Varun Aggarwal, Olivier Grisel and Antoine Baker. #22046Enhancement
class_likelihood_ratios
now has areplace_undefined_by
param. When there is a division by zero, the metric is undefined and the set values are returned forLR+
andLR-
. By Stefanie Senger #29288Fix
metrics.log_loss
now raises aValueError
if values ofy_true
are missing inlabels
. By Varun Aggarwal, Olivier Grisel and Antoine Baker. #22046Fix
class_likelihood_ratios
now raisesUndefinedMetricWarning
instead ofUserWarning
when a division by zero occurs. By Stefanie Senger #29288Fix
metrics.RocCurveDisplay
will no longer set a legend whenlabel
isNone
in both theline_kwargs
and thechance_level_kw
. By Arturo Amor #29727
sklearn.mixture
#
Feature Added an attribute
lower_bounds_
in themixture.BaseMixture
class to save the list of lower bounds for each iteration thereby providing insights into the convergence behavior of mixture models likemixture.GaussianMixture
. By Manideep Yenugula #28559Efficiency Simplified redundant computation when estimating covariances in
GaussianMixture
with acovariance_type="spherical"
orcovariance_type="diag"
. By Leonce Mekinda and Olivier Grisel #30414Efficiency
GaussianMixture
now consistently operates atfloat32
precision when fitted withfloat32
data to improve training speed and memory efficiency. Previously, part of the computation would be implicitly cast tofloat64
. By Olivier Grisel and Omar Salman. #30415
sklearn.model_selection
#
Fix Hyper-parameter optimizers such as
model_selection.GridSearchCV
now forwardsample_weight
to the scorer even when metadata routing is not enabled. By Antoine Baker #30743
sklearn.multioutput
#
Enhancement The parameter
base_estimator
has been deprecated in favour ofestimator
formultioutput.RegressorChain
andmultioutput.ClassifierChain
. By Success Moses and dikraMasrour #30152
sklearn.neural_network
#
Feature Added support for
sample_weight
inneural_network.MLPClassifier
andneural_network.MLPRegressor
. By Zach Shu and Christian Lorentzen #30155
sklearn.pipeline
#
Enhancement Expose the
verbose_feature_names_out
argument in thepipeline.make_union
function, allowing users to control feature name uniqueness in thepipeline.FeatureUnion
. By Abhijeetsingh Meena #30406
sklearn.preprocessing
#
Enhancement
preprocessing.KBinsDiscretizer
withstrategy="uniform"
now acceptssample_weight
. Additionally withstrategy="quantile"
thequantile_method
can now be specified (in the futurequantile_method="averaged_inverted_cdf"
will become the default) #29907 by Shruti Nath and Olivier Grisel #29907Fix
preprocessing.KBinsDiscretizer
now uses weighted resampling when sample weights are given and subsampling is used. This may change results even when not using sample weights, although in absolute and not in terms of statistical properties. #29907 by Shruti Nath and Jérémie du Boisberranger #29907
sklearn.svm
#
Fix
svm.LinearSVC
now properly passes sample weights toutils.class_weight.compute_class_weight
when fit withclass_weight="balanced"
. By Shruti Nath #30057
sklearn.utils
#
Enhancement
utils.class_weight.compute_class_weight
now properly accounts for sample weights when using strategy “balanced” to calculate class weights. By Shruti Nath #30057Enhancement Warning filters from the main process are propagated to joblib workers. By Thomas Fan #30380
- Enhancement - :func:
resample
now handles sample weights which allowsweighted resampling. #29907 by Shruti Nath and Olivier Grisel #29907
- Fix In
utils.estimator_checks
we now enforce for binary classifiers a binary
y
by taking the minimum as the negative class instead of the first element, which makes it robust toy
shuffling. It prevents two checks from wrongly failing on binary classifiers. By Antoine Baker. #30775
- Fix In
Code and documentation contributors
Thanks to everyone who has contributed to the maintenance and improvement of the project since version 1.7, including:
TODO: update at the time of the release.