Version 0.21
scikit-learn Docs · نسخهٔ 5e9184e53cd3 · BSD-3-Clause
============
Version 0.21
Version 0.21.3
July 30, 2019
Changed models
The following estimators and functions, when fit with the same data and parameters, may produce different models from the previous version. This often occurs due to changes in the modelling logic (bug fixes or enhancements), or in random sampling procedures.
- The v0.20.0 release notes failed to mention a backwards incompatibility in
metrics.make_scorer when needs_proba=True and y_true is binary. Now, the scorer function is supposed to accept a 1D y_pred (i.e., probability of the positive class, shape (n_samples,)), instead of a 2D y_pred (i.e., shape (n_samples, 2)).
Changelog
sklearn.cluster ......................
- |Fix| Fixed a bug in
cluster.KMeanswhere computation with
init='random' was single threaded for n_jobs > 1 or n_jobs = -1. 12955 by Prabakaran Kumaresshan <nixphix>.
- |Fix| Fixed a bug in
cluster.OPTICSwhere users were unable to pass
float min_samples and min_cluster_size. 14496 by Fabian Klopfer <someusername1> and Hanmin Qin <qinhanmin2014>.
- |Fix| Fixed a bug in
cluster.KMeanswhere KMeans++ initialisation
could rarely result in an IndexError. 11756 by Joel Nothman_.
sklearn.compose ......................
- |Fix| Fixed an issue in
compose.ColumnTransformerwhere using
DataFrames whose column order differs between fit and transform could lead to silently passing incorrect columns to the `remainder transformer. 14237 by Andreas Schuderer <schuderer>`.
sklearn.datasets .......................
- |Fix|
datasets.fetch_california_housing,
datasets.fetch_covtype, datasets.fetch_kddcup99, datasets.fetch_olivetti_faces, datasets.fetch_rcv1, and datasets.fetch_species_distributions try to persist the previously cache using the new `joblib if the cached data was persisted using the deprecated sklearn.externals.joblib. This behavior is set to be deprecated and removed in v0.23. 14197 by Adrin Jalali`_.
sklearn.ensemble .......................
- |Fix| Fix zero division error in
ensemble.HistGradientBoostingClassifierand
ensemble.HistGradientBoostingRegressor. 14024 by Nicolas Hug <NicolasHug>.
sklearn.impute .....................
- |Fix| Fixed a bug in
impute.SimpleImputerand
impute.IterativeImputer so that no errors are thrown when there are missing values in training data. 13974 by Frank Hoang <fhoang7>.
sklearn.inspection .........................
- |Fix| Fixed a bug in
inspection.plot_partial_dependencewhere
`target parameter was not being taken into account for multiclass problems. 14393 by Guillem G. Subies <guillemgsubies>`.
sklearn.linear_model ...........................
- |Fix| Fixed a bug in
linear_model.LogisticRegressionCVwhere
`refit=False would fail depending on the 'multiclass' and 'penalty' parameters (regression introduced in 0.21). 14087 by Nicolas Hug`_.
- |Fix| Compatibility fix for
linear_model.ARDRegressionand
Scipy>=1.3.0. Adapts to upstream changes to the default pinvh cutoff threshold which otherwise results in poor accuracy in some cases. 14067 by Tim Staley <timstaley>.
sklearn.neighbors ........................
- |Fix| Fixed a bug in
neighbors.NeighborhoodComponentsAnalysiswhere
the validation of initial parameters `n_components, max_iter and tol required too strict types. 14092 by Jérémie du Boisberranger <jeremiedbb>`.
sklearn.tree ...................
- |Fix| Fixed bug in
tree.export_textwhen the tree has one feature and
a single feature name is passed in. 14053 by Thomas Fan.
- |Fix| Fixed an issue with
tree.plot_treewhere it displayed
entropy calculations even for gini criterion in DecisionTreeClassifiers. 13947 by Frank Hoang <fhoang7>.
Version 0.21.2
24 May 2019
Changelog
sklearn.decomposition ............................
- |Fix| Fixed a bug in
cross_decomposition.CCAimproving numerical
stability when Y is close to zero. 13903 by Thomas Fan_.
sklearn.metrics ......................
- |Fix| Fixed a bug in
metrics.pairwise.euclidean_distanceswhere a
part of the distance matrix was left un-instanciated for sufficiently large float32 datasets (regression introduced in 0.21). 13910 by Jérémie du Boisberranger <jeremiedbb>.
sklearn.preprocessing ............................
- |Fix| Fixed a bug in
preprocessing.OneHotEncoderwhere the new
drop parameter was not reflected in get_feature_names. 13894 by James Myatt <jamesmyatt>.
sklearn.utils.sparsefuncs ...........................
- |Fix| Fixed a bug where
min_max_axiswould fail on 32-bit systems
for certain large inputs. This affects preprocessing.MaxAbsScaler, preprocessing.normalize and preprocessing.LabelBinarizer. 13741 by Roddy MacSween <rlms>.
Version 0.21.1
17 May 2019
This is a bug-fix release to primarily resolve some packaging issues in version 0.21.0. It also includes minor documentation improvements and some bug fixes.
Changelog
sklearn.inspection .........................
- |Fix| Fixed a bug in
inspection.partial_dependenceto only check
classifier and not regressor for the multiclass-multioutput case. 14309 by Guillaume Lemaitre <glemaitre>.
sklearn.metrics ......................
- |Fix| Fixed a bug in
metrics.pairwise_distanceswhere it would raise
`AttributeError for boolean metrics when X had a boolean dtype and Y == None. 13864 by Paresh Mathur <rick2047>`.
- |Fix| Fixed two bugs in
metrics.pairwise_distanceswhen
`n_jobs > 1. First it used to return a distance matrix with same dtype as input, even for integer dtype. Then the diagonal was not zeros for euclidean metric when Y is X. 13877 by Jérémie du Boisberranger <jeremiedbb>`.
sklearn.neighbors ........................
- |Fix| Fixed a bug in
neighbors.KernelDensitywhich could not be
restored from a pickle if `sample_weight had been used. 13772 by Aditya Vyas <aditya1702>`.
Version 0.21.0
May 2019
Changed models
The following estimators and functions, when fit with the same data and parameters, may produce different models from the previous version. This often occurs due to changes in the modelling logic (bug fixes or enhancements), or in random sampling procedures.
discriminant_analysis.LinearDiscriminantAnalysisfor multiclass
classification. |Fix|
discriminant_analysis.LinearDiscriminantAnalysiswith 'eigen'
solver. |Fix|
linear_model.BayesianRidge|Fix|- Decision trees and derived ensembles when both
max_depthand
max_leaf_nodes are set. |Fix|
linear_model.LogisticRegressionand
linear_model.LogisticRegressionCV with 'saga' solver. |Fix|
ensemble.GradientBoostingClassifier|Fix|sklearn.feature_extraction.text.HashingVectorizer,
sklearn.feature_extraction.text.TfidfVectorizer, and sklearn.feature_extraction.text.CountVectorizer |Fix|
neural_network.MLPClassifier|Fix|svm.SVC.decision_functionand
multiclass.OneVsOneClassifier.decision_function. |Fix|
linear_model.SGDClassifierand any derived classifiers. |Fix|- Any model using the
linear_model._sag.sag_solverfunction with a0
seed, including linear_model.LogisticRegression, linear_model.LogisticRegressionCV, linear_model.Ridge, and linear_model.RidgeCV with 'sag' solver. |Fix|
linear_model.RidgeCVwhen using leave-one-out cross-validation
with sparse inputs. |Fix|
Details are listed in the changelog below.
(While we are trying to better inform users by providing this information, we cannot assure that this list is complete.)
Known Major Bugs
- The default
max_iterforlinear_model.LogisticRegressionis too
small for many solvers given the default tol. In particular, we accidentally changed the default max_iter for the liblinear solver from 1000 to 100 iterations in 3591 released in version 0.16. In a future release we hope to choose better default max_iter and tol heuristically depending on the solver (see 13317).
Changelog
Support for Python 3.4 and below has been officially dropped.
.. Entries should be grouped by module (in alphabetic order) and prefixed with one of the labels: |MajorFeature|, |Feature|, |Efficiency|, |Enhancement|,
| Fix | or | API | (see whats_new.rst for descriptions). |
Entries should be ordered by those labels (e.g. |Fix| after |Efficiency|). Changes not specific to a module should be listed under *Multiple Modules* or *Miscellaneous*. Entries should end with: 123456 by Joe Bloggs <joeongithub>. where 123456 is the *pull request* number, not the issue number.
sklearn.base ...................
- |API| The R2 score used when calling `
score` on a regressor will use
`multioutput='uniform_average' from version 0.23 to keep consistent with metrics.r2_score. This will influence the score method of all the multioutput regressors (except for multioutput.MultiOutputRegressor). 13157 by Hanmin Qin <qinhanmin2014>`.
sklearn.calibration ..........................
- |Enhancement| Added support to bin the data passed into
calibration.calibration_curve by quantiles instead of uniformly between 0 and 1. 13086 by Scott Cole <srcole>.
- |Enhancement| Allow n-dimensional arrays as input for
calibration.CalibratedClassifierCV. 13485 by William de Vazelhes <wdevazelhes>.
sklearn.cluster ......................
- |MajorFeature| A new clustering algorithm:
cluster.OPTICS: an
algorithm related to cluster.DBSCAN, that has hyperparameters easier to set and that scales better, by Shane <espg>, Adrin Jalali_, Erich Schubert <kno10>, Hanmin Qin_, and Assia Benbihi <assiaben>.
- |Fix| Fixed a bug where
cluster.Birchcould occasionally raise an
AttributeError. 13651 by Joel Nothman_.
- |Fix| Fixed a bug in
cluster.KMeanswhere empty clusters weren't
correctly relocated when using sample weights. 13486 by Jérémie du Boisberranger <jeremiedbb>.
- |API| The `
n_components_attribute incluster.AgglomerativeClustering`
and cluster.FeatureAgglomeration has been renamed to `n_connected_components_. 13427 by Stephane Couvreur <scouvreur>`.
- |Enhancement|
cluster.AgglomerativeClusteringand
cluster.FeatureAgglomeration now accept a `distance_threshold parameter which can be used to find the clusters instead of n_clusters. 9069 by Vathsala Achar <VathsalaAchar> and Adrin Jalali`_.
sklearn.compose ......................
- |API|
compose.ColumnTransformeris no longer an experimental
feature. 13835 by Hanmin Qin <qinhanmin2014>.
sklearn.datasets .......................
- |Fix| Added support for 64-bit group IDs and pointers in SVMLight files.
10727 by Bryan K Woods <bryan-woods>.
- |Fix|
datasets.load_sample_imagesreturns images with a deterministic
order. 13250 by Thomas Fan <thomasjpfan>.
sklearn.decomposition ............................
- |Enhancement|
decomposition.KernelPCAnow has deterministic output
(resolved sign ambiguity in eigenvalue decomposition of the kernel matrix). 13241 by Aurélien Bellet <bellet>.
- |Fix| Fixed a bug in
decomposition.KernelPCA,fit().transform()
now produces the correct output (the same as fit_transform()) in case of non-removed zero eigenvalues (remove_zero_eig=False). fit_inverse_transform was also accelerated by using the same trick as fit_transform to compute the transform of X. 12143 by Sylvain Marié <smarie>
- |Fix| Fixed a bug in
decomposition.NMFwhereinit = 'nndsvd',
init = 'nndsvda', and init = 'nndsvdar' are allowed when n_components < n_features instead of n_components <= min(n_samples, n_features). 11650 by Hossein Pourbozorg <hossein-pourbozorg> and Zijie (ZJ) Poh <zjpoh>.
- |API| The default value of the
initargument in
decomposition.non_negative_factorization will change from random to None in version 0.23 to make it consistent with decomposition.NMF. A FutureWarning is raised when the default value is used. 12988 by Zijie (ZJ) Poh <zjpoh>.
sklearn.discriminant_analysis ....................................
- |Enhancement|
discriminant_analysis.LinearDiscriminantAnalysisnow
preserves `float32 and float64 dtypes. 8769 and 11000 by Thibault Sejourne <thibsej>`
- |Fix| A `
ChangedBehaviourWarning` is now raised when
discriminant_analysis.LinearDiscriminantAnalysis is given as parameter `n_components > min(n_features, n_classes - 1), and n_components is changed to min(n_features, n_classes - 1) if so. Previously the change was made, but silently. 11526 by William de Vazelhes<wdevazelhes>`.
- |Fix| Fixed a bug in
discriminant_analysis.LinearDiscriminantAnalysis
where the predicted probabilities would be incorrectly computed in the multiclass case. 6848, by :user:Agamemnon Krasoulis <agamemnonc> and Guillaume Lemaitre <glemaitre>.
- |Fix| Fixed a bug in
discriminant_analysis.LinearDiscriminantAnalysis
where the predicted probabilities would be incorrectly computed with `eigen solver. 11727, by :user:Agamemnon Krasoulis <agamemnonc>`.
sklearn.dummy ....................
- |Fix| Fixed a bug in
dummy.DummyClassifierwhere the
`predict_proba method was returning int32 array instead of float64 for the stratified strategy. 13266 by Christos Aridas<chkoar>`.
- |Fix| Fixed a bug in
dummy.DummyClassifierwhere it was throwing a
dimension mismatch error in prediction time if a column vector `y with shape=(n, 1) was given at fit time. 13545 by :user:Nick Sorros <nsorros> and Adrin Jalali`_.
sklearn.ensemble .......................
- |MajorFeature| Add two new implementations of
gradient boosting trees: ensemble.HistGradientBoostingClassifier and ensemble.HistGradientBoostingRegressor. The implementation of these estimators is inspired by LightGBM <https://github.com/Microsoft/LightGBM>_ and can be orders of magnitude faster than ensemble.GradientBoostingRegressor and ensemble.GradientBoostingClassifier when the number of samples is larger than tens of thousands of samples. The API of these new estimators is slightly different, and some of the features from ensemble.GradientBoostingClassifier and ensemble.GradientBoostingRegressor are not yet supported.
These new estimators are experimental, which means that their results or their API might change without any deprecation cycle. To use them, you need to explicitly import `enable_hist_gradient_boosting`::
توجه: >> # explicitly require this experimental feature >> from sklearn.experimental import enable_hist_gradient_boosting # noqa >> # now you can import normally from sklearn.ensemble >> from sklearn.ensemble import HistGradientBoostingClassifier
Update: since version 1.0, these estimators are not experimental anymore and you don't need to use from sklearn.experimental import enable_hist_gradient_boosting.
12807 by Nicolas Hug<NicolasHug>.
- |Feature| Add
ensemble.VotingRegressor
which provides an equivalent of ensemble.VotingClassifier for regression problems. 12513 by Ramil Nugmanov <stsouko> and Mohamed Ali Jamaoui <mohamed-ali>.
- |Efficiency| Make
ensemble.IsolationForestprefer threads over
processes when running with `n_jobs > 1 as the underlying decision tree fit calls do release the GIL. This change reduces memory usage and communication overhead. 12543 by Isaac Storch <istorch> and Olivier Grisel`_.
- |Efficiency| Make
ensemble.IsolationForestmore memory efficient
by avoiding keeping in memory each tree prediction. 13260 by Nicolas Goix_.
- |Efficiency|
ensemble.IsolationForestnow uses chunks of data at
prediction step, thus capping the memory usage. 13283 by Nicolas Goix_.
- |Efficiency|
sklearn.ensemble.GradientBoostingClassifierand
sklearn.ensemble.GradientBoostingRegressor now keep the input `y as float64 to avoid it being copied internally by trees. 13524 by Adrin Jalali`_.
- |Enhancement| Minimized the validation of X in
ensemble.AdaBoostClassifier and ensemble.AdaBoostRegressor 13174 by Christos Aridas <chkoar>.
- |Enhancement|
ensemble.IsolationForestnow exposes `warm_start`
parameter, allowing iterative addition of trees to an isolation forest. 13496 by Peter Marko <petibear>.
- |Fix| The values of `
feature_importances_` in all random forest based
models (i.e. ensemble.RandomForestClassifier, ensemble.RandomForestRegressor, ensemble.ExtraTreesClassifier, ensemble.ExtraTreesRegressor, ensemble.RandomTreesEmbedding, ensemble.GradientBoostingClassifier, and ensemble.GradientBoostingRegressor) now:
- sum up to `
1` - all the single node trees in feature importance calculation are ignored
- in case all trees have only one single node (i.e. a root node),
feature importances will be an array of all zeros.
13636 and 13620 by Adrin Jalali_.
- |Fix| Fixed a bug in
ensemble.GradientBoostingClassifierand
ensemble.GradientBoostingRegressor, which didn't support scikit-learn estimators as the initial estimator. Also added support of initial estimator which does not support sample weights. 12436 by Jérémie du Boisberranger <jeremiedbb> and 12983 by Nicolas Hug<NicolasHug>.
- |Fix| Fixed the output of the average path length computed in
ensemble.IsolationForest when the input is either 0, 1 or 2. 13251 by Albert Thomas <albertcthomas> and joshuakennethjones <joshuakennethjones>.
- |Fix| Fixed a bug in
ensemble.GradientBoostingClassifierwhere
the gradients would be incorrectly computed in multiclass classification problems. 12715 by Nicolas Hug<NicolasHug>.
- |Fix| Fixed a bug in
ensemble.GradientBoostingClassifierwhere
validation sets for early stopping were not sampled with stratification. 13164 by Nicolas Hug<NicolasHug>.
- |Fix| Fixed a bug in
ensemble.GradientBoostingClassifierwhere
the default initial prediction of a multiclass classifier would predict the classes priors instead of the log of the priors. 12983 by Nicolas Hug<NicolasHug>.
- |Fix| Fixed a bug in
ensemble.RandomForestClassifierwhere the
`predict method would error for multiclass multioutput forests models if any targets were strings. 12834 by :user:Elizabeth Sander <elsander>`.
- |Fix| Fixed a bug in
ensemble.gradient_boosting.LossFunctionand
ensemble.gradient_boosting.LeastSquaresError where the default value of `learning_rate in update_terminal_regions is not consistent with the document and the caller functions. Note however that directly using these loss functions is deprecated. 6463 by movelikeriver <movelikeriver>`.
- |Fix|
ensemble.partial_dependence(and consequently the new
version sklearn.inspection.partial_dependence) now takes sample weights into account for the partial dependence computation when the gradient boosting model has been trained with sample weights. 13193 by Samuel O. Ronsin <samronsin>.
- |API|
ensemble.partial_dependenceand
ensemble.plot_partial_dependence are now deprecated in favor of inspection.partial_dependence<sklearn.inspection.partial_dependence> and inspection.plot_partial_dependence<sklearn.inspection.plot_partial_dependence>. 12599 by Trevor Stephens<trevorstephens> and Nicolas Hug<NicolasHug>.
- |Fix|
ensemble.VotingClassifierand
ensemble.VotingRegressor were failing during `fit in one of the estimators was set to None and sample_weight was not None. 13779 by Guillaume Lemaitre <glemaitre>`.
- |API|
ensemble.VotingClassifierand
ensemble.VotingRegressor accept `'drop' to disable an estimator in addition to None to be consistent with other estimators (i.e., pipeline.FeatureUnion and compose.ColumnTransformer). 13780 by Guillaume Lemaitre <glemaitre>`.
sklearn.externals ...................
- |API| Deprecated
externals.sixsince we have dropped support for
Python 2.7. 12916 by Hanmin Qin <qinhanmin2014>.
sklearn.feature_extraction .................................
- |Fix| If `
input='file'orinput='filename'`, and a callable is given as
the `analyzer, sklearn.feature_extraction.text.HashingVectorizer, sklearn.feature_extraction.text.TfidfVectorizer, and sklearn.feature_extraction.text.CountVectorizer now read the data from the file(s) and then pass it to the given analyzer, instead of passing the file name(s) or the file object(s) to the analyzer. 13641 by Adrin Jalali`_.
sklearn.impute .....................
- |MajorFeature| Added
impute.IterativeImputer, which is a strategy
for imputing missing values by modeling each feature with missing values as a function of other features in a round-robin fashion. 8478 and 12177 by Sergey Feldman <sergeyf> and :user:Ben Lawson <benlawson>.
The API of IterativeImputer is experimental and subject to change without any deprecation cycle. To use them, you need to explicitly import `enable_iterative_imputer`::
توجه: >> from sklearn.experimental import enable_iterative_imputer # noqa >> # now you can import normally from sklearn.impute >> from sklearn.impute import IterativeImputer
- |Feature| The
impute.SimpleImputerand
impute.IterativeImputer have a new parameter `'add_indicator', which simply stacks a impute.MissingIndicator transform into the output of the imputer's transform. That allows a predictive estimator to account for missingness. 12583, 13601 by :user:Danylo Baibak <DanilBaibak>`.
- |Fix| In
impute.MissingIndicatoravoid implicit densification by
raising an exception if input is sparse and missing_values property is set to 0. 13240 by Bartosz Telenczuk <btel>.
- |Fix| Fixed two bugs in
impute.MissingIndicator. First, when
`X is sparse, all the non-zero non missing values used to become explicit False in the transformed data. Then, when features='missing-only', all features used to be kept if there were no missing values at all. 13562 by :user:Jérémie du Boisberranger <jeremiedbb>`.
sklearn.inspection .........................
(new subpackage)
- |Feature| Partial dependence plots
(inspection.plot_partial_dependence) are now supported for any regressor or classifier (provided that they have a predict_proba method). 12599 by Trevor Stephens <trevorstephens> and Nicolas Hug <NicolasHug>.
sklearn.isotonic .......................
- |Feature| Allow different dtypes (such as float32) in
isotonic.IsotonicRegression. 8769 by Vlad Niculae <vene>
sklearn.linear_model ...........................
- |Enhancement|
linear_model.Ridgenow preserves `float32` and
`float64 dtypes. 8769 and 11000 by Guillaume Lemaitre <glemaitre>, and Joan Massich <massich>`
- |Feature|
linear_model.LogisticRegressionand
linear_model.LogisticRegressionCV now support Elastic-Net penalty, with the 'saga' solver. 11646 by Nicolas Hug <NicolasHug>.
- |Feature| Added
linear_model.lars_path_gram, which is
linear_model.lars_path in the sufficient stats mode, allowing users to compute linear_model.lars_path without providing `X and y. 11699 by Kuai Yu <yukuairoy>`.
- |Efficiency|
linear_model.make_datasetnow preserves
`float32 and float64 dtypes, reducing memory consumption in stochastic gradient, SAG and SAGA solvers. 8769 and 11000 by Nelle Varoquaux <NelleV>, Arthur Imbert <Henley13>, Guillaume Lemaitre <glemaitre>, and Joan Massich <massich>`
- |Enhancement|
linear_model.LogisticRegressionnow supports an
unregularized objective when `penalty='none' is passed. This is equivalent to setting C=np.inf with l2 regularization. Not supported by the liblinear solver. 12860 by :user:Nicolas Hug <NicolasHug>`.
- |Enhancement|
sparse_cgsolver inlinear_model.Ridge
now supports fitting the intercept (i.e. `fit_intercept=True) when inputs are sparse. 13336 by Bartosz Telenczuk <btel>`.
- |Enhancement| The coordinate descent solver used in
Lasso,ElasticNet,
etc. now issues a ConvergenceWarning when it completes without meeting the desired tolerance. 11754 and 13397 by Brent Fagan <brentfagan> and Adrin Jalali <adrinjalali>.
- |Fix| Fixed a bug in
linear_model.LogisticRegressionand
linear_model.LogisticRegressionCV with 'saga' solver, where the weights would not be correctly updated in some cases. 11646 by Tom Dupre la Tour_.
- |Fix| Fixed the posterior mean, posterior covariance and returned
regularization parameters in linear_model.BayesianRidge. The posterior mean and the posterior covariance were not the ones computed with the last update of the regularization parameters and the returned regularization parameters were not the final ones. Also fixed the formula of the log marginal likelihood used to compute the score when compute_score=True. 12174 by Albert Thomas <albertcthomas>.
- |Fix| Fixed a bug in
linear_model.LassoLarsIC, where user input
`copy_X=False at instance creation would be overridden by default parameter value copy_X=True in fit. 12972 by Lucio Fernandez-Arjona <luk-f-a>`
- |Fix| Fixed a bug in
linear_model.LinearRegressionthat
was not returning the same coefficients and intercepts with `fit_intercept=True in sparse and dense case. 13279 by Alexandre Gramfort`_
- |Fix| Fixed a bug in
linear_model.HuberRegressorthat was
broken when `X was of dtype bool. 13328 by Alexandre Gramfort`_.
- |Fix| Fixed a performance issue of `
sagaandsag` solvers when called
in a joblib.Parallel setting with `n_jobs > 1 and backend="threading", causing them to perform worse than in the sequential case. 13389 by Pierre Glaser <pierreglaser>`.
- |Fix| Fixed a bug in
linear_model.stochastic_gradient.BaseSGDClassifier that was not deterministic when trained in a multi-class setting on several threads. 13422 by Clément Doumouro <ClemDoum>.
- |Fix| Fixed bug in
linear_model.ridge_regression,
linear_model.Ridge and linear_model.RidgeClassifier that caused unhandled exception for arguments `return_intercept=True and solver=auto (default) or any other solver different from sag. 13363 by Bartosz Telenczuk <btel>`
- |Fix|
linear_model.ridge_regressionwill now raise an exception
if `return_intercept=True and solver is different from sag. Previously, only warning was issued. 13363 by Bartosz Telenczuk <btel>`
- |Fix|
linear_model.ridge_regressionwill choose `sparse_cg`
solver for sparse inputs when `solver=auto and sample_weight is provided (previously cholesky solver was selected). 13363 by Bartosz Telenczuk <btel>`
- |API| The use of
linear_model.lars_pathwith `X=None`
while passing `Gram is deprecated in version 0.21 and will be removed in version 0.23. Use linear_model.lars_path_gram instead. 11699 by Kuai Yu <yukuairoy>`.
- |API|
linear_model.logistic_regression_pathis deprecated
in version 0.21 and will be removed in version 0.23. 12821 by Nicolas Hug <NicolasHug>.
- |Fix|
linear_model.RidgeCVwith leave-one-out cross-validation
now correctly fits an intercept when `fit_intercept=True and the design matrix is sparse. 13350 by Jérôme Dockès <jeromedockes>`
sklearn.manifold .......................
- |Efficiency| Make
manifold.trustworthinessuse an inverted index
instead of an np.where lookup to find the rank of neighbors in the input space. This improves efficiency in particular when computed with lots of neighbors and/or small datasets. 9907 by William de Vazelhes <wdevazelhes>.
sklearn.metrics ......................
- |Feature| Added the
metrics.max_errormetric and a corresponding
`'max_error' scorer for single output regression. 12232 by Krishna Sangeeth <whiletruelearn>`.
- |Feature| Add
metrics.multilabel_confusion_matrix, which calculates a
confusion matrix with true positive, false positive, false negative and true negative counts for each class. This facilitates the calculation of set-wise metrics such as recall, specificity, fall out and miss rate. 11179 by Shangwu Yao <ShangwuYao> and Joel Nothman_.
- |Feature|
metrics.jaccard_scorehas been added to calculate the
Jaccard coefficient as an evaluation metric for binary, multilabel and multiclass tasks, with an interface analogous to metrics.f1_score. 13151 by Gaurav Dhingra <gxyd> and Joel Nothman_.
- |Feature| Added
metrics.pairwise.haversine_distanceswhich can be
accessed with metric='pairwise' through metrics.pairwise_distances and estimators. (Haversine distance was previously available for nearest neighbors calculation.) 12568 by Wei Xue <xuewei4d>, Emmanuel Arias <eamanu> and Joel Nothman_.
- |Efficiency| Faster
metrics.pairwise_distanceswithn_jobs
توجه: 1 by using a thread-based backend, instead of process-based backends.
8216 by Pierre Glaser <pierreglaser> and Romuald Menuet <zanospi>
- |Efficiency| The pairwise manhattan distances with sparse input now uses the
BLAS shipped with scipy instead of the bundled BLAS. 12732 by Jérémie du Boisberranger <jeremiedbb>
- |Enhancement| Use label
accuracyinstead ofmicro-averageon
metrics.classification_report to avoid confusion. micro-average is only shown for multi-label or multi-class with a subset of classes because it is otherwise identical to accuracy. 12334 by Emmanuel Arias <eamanu@eamanu.com>, Joel Nothman_ and Andreas Müller_
- |Enhancement| Added
betaparameter to
metrics.homogeneity_completeness_v_measure and metrics.v_measure_score to configure the tradeoff between homogeneity and completeness. 13607 by Stephane Couvreur <scouvreur> and and Ivan Sanchez <ivsanro1>.
- |Fix| The metric
metrics.r2_scoreis degenerate with a single sample
and now it returns NaN and raises exceptions.UndefinedMetricWarning. 12855 by Pawel Sendyk <psendyk>.
- |Fix| Fixed a bug where
metrics.brier_score_losswill sometimes
return incorrect result when there's only one class in `y_true. 13628 by Hanmin Qin <qinhanmin2014>`.
- |Fix| Fixed a bug in
metrics.label_ranking_average_precision_score
where sample_weight wasn't taken into account for samples with degenerate labels. 13447 by Dan Ellis <dpwe>.
- |API| The parameter `
labelsinmetrics.hamming_loss` is deprecated
in version 0.21 and will be removed in version 0.23. 10580 by Reshama Shaikh <reshamas> and Sandra Mitrovic <SandraMNE>.
- |Fix| The function
metrics.pairwise.euclidean_distances, and
therefore several estimators with `metric='euclidean', suffered from numerical precision issues with float32 features. Precision has been increased at the cost of a small drop of performance. 13554 by Celelibi and Jérémie du Boisberranger <jeremiedbb>`.
- |API|
metrics.jaccard_similarity_scoreis deprecated in favour of
the more consistent metrics.jaccard_score. The former behavior for binary and multiclass targets is broken. 13151 by Joel Nothman_.
sklearn.mixture ......................
- |Fix| Fixed a bug in
mixture.BaseMixtureand therefore on estimators
based on it, i.e. mixture.GaussianMixture and mixture.BayesianGaussianMixture, where `fit_predict and fit.predict were not equivalent. 13142 by Jérémie du Boisberranger <jeremiedbb>`.
sklearn.model_selection ..............................
- |Feature| Classes
~model_selection.GridSearchCVand
~model_selection.RandomizedSearchCV now allow for refit=callable to add flexibility in identifying the best estimator. See sphx_glr_auto_examples_model_selection_plot_grid_search_refit_callable.py. 11354 by Wenhao Zhang <wenhaoz@ucla.edu>, Joel Nothman_ and Adrin Jalali <adrinjalali>.
- |Enhancement| Classes
~model_selection.GridSearchCV,
~model_selection.RandomizedSearchCV, and methods ~model_selection.cross_val_score, ~model_selection.cross_val_predict, ~model_selection.cross_validate, now print train scores when return_train_scores is True and verbose > 2. For ~model_selection.learning_curve, and ~model_selection.validation_curve only the latter is required. 12613 and 12669 by Marc Torrellas <marctorrellas>.
- |Enhancement| Some
CV splitterclasses and
model_selection.train_test_split now raise `ValueError when the resulting training set is empty. 12861 by Nicolas Hug <NicolasHug>`.
- |Fix| Fixed a bug where
model_selection.StratifiedKFold
shuffles each class's samples with the same `random_state, making shuffle=True ineffective. 13124 by Hanmin Qin <qinhanmin2014>`.
- |Fix| Added ability for
model_selection.cross_val_predictto handle
multi-label (and multioutput-multiclass) targets with `predict_proba-type methods. 8773 by Stephen Hoover <stephen-hoover>`.
- |Fix| Fixed an issue in
~model_selection.cross_val_predictwhere
method="predict_proba" returned always 0.0 when one of the classes was excluded in a cross-validation fold. 13366 by Guillaume Fournier <gfournier>
sklearn.multiclass .........................
- |Fix| Fixed an issue in
multiclass.OneVsOneClassifier.decision_function
where the decision_function value of a given sample was different depending on whether the decision_function was evaluated on the sample alone or on a batch containing this same sample due to the scaling used in decision_function. 10440 by Jonathan Ohayon <Johayon>.
sklearn.multioutput ..........................
- |Fix| Fixed a bug in
multioutput.MultiOutputClassifierwhere the
predict_proba method incorrectly checked for predict_proba attribute in the estimator object. 12222 by Rebekah Kim <rebekahkim>
sklearn.neighbors ........................
- |MajorFeature| Added
neighbors.NeighborhoodComponentsAnalysisfor
metric learning, which implements the Neighborhood Components Analysis algorithm. 10058 by William de Vazelhes <wdevazelhes> and John Chiotellis <johny-c>.
- |API| Methods in
neighbors.NearestNeighbors:
~neighbors.NearestNeighbors.kneighbors, ~neighbors.NearestNeighbors.radius_neighbors, ~neighbors.NearestNeighbors.kneighbors_graph, ~neighbors.NearestNeighbors.radius_neighbors_graph now raise `NotFittedError, rather than AttributeError, when called before fit 12279 by :user:Krishna Sangeeth <whiletruelearn>`.
sklearn.neural_network .............................
- |Fix| Fixed a bug in
neural_network.MLPClassifierand
neural_network.MLPRegressor where the option shuffle=False was being ignored. 12582 by Sam Waterbury <samwaterbury>.
- |Fix| Fixed a bug in
neural_network.MLPClassifierwhere
validation sets for early stopping were not sampled with stratification. In the multilabel case however, splits are still not stratified. 13164 by Nicolas Hug<NicolasHug>.
sklearn.pipeline .......................
- |Feature|
pipeline.Pipelinecan now use indexing notation (e.g.
`my_pipeline[0:-1]) to extract a subsequence of steps as another Pipeline instance. A Pipeline can also be indexed directly to extract a particular step (e.g. my_pipeline['svc']), rather than accessing named_steps. 2568 by Joel Nothman`_.
- |Feature| Added optional parameter `
verboseinpipeline.Pipeline`,
compose.ColumnTransformer and pipeline.FeatureUnion and corresponding `make_ helpers for showing progress and timing of each step. 11364 by Baze Petrushev <petrushev>, Karan Desai <karandesai-96>, Joel Nothman_, and Thomas Fan <thomasjpfan>`.
- |Enhancement|
pipeline.Pipelinenow supports using `'passthrough'`
as a transformer, with the same effect as `None. 11144 by Thomas Fan <thomasjpfan>`.
- |Enhancement|
pipeline.Pipelineimplements `__len__` and
therefore `len(pipeline) returns the number of steps in the pipeline. 13439 by Lakshya KD <LakshKD>`.
sklearn.preprocessing ............................
- |Feature|
preprocessing.OneHotEncodernow supports dropping one
feature per category with a new drop parameter. 12908 by Drew Johnston <drewmjohnston>.
- |Efficiency|
preprocessing.OneHotEncoderand
preprocessing.OrdinalEncoder now handle pandas DataFrames more efficiently. 13253 by maikia.
- |Efficiency| Make
preprocessing.MultiLabelBinarizercache class
mappings instead of calculating it every time on the fly. 12116 by Ekaterina Krivich <kiote> and Joel Nothman_.
- |Efficiency|
preprocessing.PolynomialFeaturesnow supports
compressed sparse row (CSR) matrices as input for degrees 2 and 3. This is typically much faster than the dense case as it scales with matrix density and expansion degree (on the order of density^degree), and is much, much faster than the compressed sparse column (CSC) case. 12197 by Andrew Nystrom <awnystrom>.
- |Efficiency| Speed improvement in
preprocessing.PolynomialFeatures,
in the dense case. Also added a new parameter `order which controls output order for further speed performances. 12251 by Tom Dupre la Tour`_.
- |Fix| Fixed the calculation overflow when using a float16 dtype with
preprocessing.StandardScaler. 13007 by Raffaello Baluyot <baluyotraf>
- |Fix| Fixed a bug in
preprocessing.QuantileTransformerand
preprocessing.quantile_transform to force n_quantiles to be at most equal to n_samples. Values of n_quantiles larger than n_samples were either useless or resulting in a wrong approximation of the cumulative distribution function estimator. 13333 by Albert Thomas <albertcthomas>.
- |API| The default value of
copyinpreprocessing.quantile_transform
will change from False to True in 0.23 in order to make it more consistent with the default copy values of other functions in sklearn.preprocessing and prevent unexpected side effects by modifying the value of X inplace. 13459 by Hunter McGushion <HunterMcGushion>.
sklearn.svm ..................
- |Fix| Fixed an issue in
svm.SVC.decision_functionwhen
`decision_function_shape='ovr'. The decision_function value of a given sample was different depending on whether the decision_function was evaluated on the sample alone or on a batch containing this same sample due to the scaling used in decision_function. 10440 by Jonathan Ohayon <Johayon>`.
sklearn.tree ...................
- |Feature| Decision Trees can now be plotted with matplotlib using
tree.plot_tree without relying on the `dot library, removing a hard-to-install dependency. 8508 by Andreas Müller`_.
- |Feature| Decision Trees can now be exported in a human readable
textual format using tree.export_text. 6261 by Giuseppe Vettigli <JustGlowing>.
- |Feature| `
get_n_leaves()andget_depth()` have been added to
tree.BaseDecisionTree and consequently all estimators based on it, including tree.DecisionTreeClassifier, tree.DecisionTreeRegressor, tree.ExtraTreeClassifier, and tree.ExtraTreeRegressor. 12300 by Adrin Jalali <adrinjalali>.
- |Fix| Trees and forests did not previously
predictmulti-output
classification targets with string labels, despite accepting them in fit. 11458 by Mitar Milutinovic <mitar>.
- |Fix| Fixed an issue with
tree.BaseDecisionTree
and consequently all estimators based on it, including tree.DecisionTreeClassifier, tree.DecisionTreeRegressor, tree.ExtraTreeClassifier, and tree.ExtraTreeRegressor, where they used to exceed the given `max_depth by 1 while expanding the tree if max_leaf_nodes and max_depth were both specified by the user. Please note that this also affects all ensemble methods using decision trees. 12344 by Adrin Jalali <adrinjalali>`.
sklearn.utils ....................
- |Feature|
utils.resamplenow accepts a `stratify` parameter for
sampling according to class distributions. 13549 by :user:Nicolas Hug <NicolasHug>.
- |API| Deprecated `
warn_on_dtypeparameter fromutils.check_array`
and utils.check_X_y. Added explicit warning for dtype conversion in check_pairwise_arrays if the `metric being passed is a pairwise boolean metric. 13382 by Prathmesh Savale <praths007>`.
Multiple modules ................
- |MajorFeature| The
__repr__()method of all estimators (used when calling
print(estimator)) has been entirely re-written, building on Python's pretty printing standard library. All parameters are printed by default, but this can be altered with the `print_changed_only option in sklearn.set_config. 11705 by :user:Nicolas Hug <NicolasHug>`.
- |MajorFeature| Add estimators tags: these are annotations of estimators
that allow programmatic inspection of their capabilities, such as sparse matrix support, supported output types and supported methods. Estimator tags also determine the tests that are run on an estimator when check_estimator is called. Read more in the :ref:User Guide <estimator_tags>. 8022 by Andreas Müller <amueller>.
- |Efficiency| Memory copies are avoided when casting arrays to a different
dtype in multiple estimators. 11973 by :user:Roman Yurchak <rth>.
- |Fix| Fixed a bug in the implementation of the
our_rand_r
helper function that was not behaving consistently across platforms. 13422 by Madhura Parikh <jdnc> and Clément Doumouro <ClemDoum>.
Miscellaneous .............
- |Enhancement| Joblib is no longer vendored in scikit-learn, and becomes a
dependency. Minimal supported version is joblib 0.11, however using version >= 0.13 is strongly recommended. 13531 by Roman Yurchak <rth>.
Changes to estimator checks
These changes mostly affect library developers.
- Add `
check_fit_idempotent` to
~utils.estimator_checks.check_estimator, which checks that when fit is called twice with the same data, the output of predict, predict_proba, transform, and decision_function does not change. 12328 by Nicolas Hug <NicolasHug>
- Many checks can now be disabled or configured with
estimator_tags.
8022 by Andreas Müller <amueller>.
Thanks to everyone who has contributed to the maintenance and improvement of the project since version 0.20, including:
adanhawth, Aditya Vyas, Adrin Jalali, Agamemnon Krasoulis, Albert Thomas, Alberto Torres, Alexandre Gramfort, amourav, Andrea Navarrete, Andreas Mueller, Andrew Nystrom, assiaben, Aurélien Bellet, Bartosz Michałowski, Bartosz Telenczuk, bauks, BenjaStudio, bertrandhaut, Bharat Raghunathan, brentfagan, Bryan Woods, Cat Chenal, Cheuk Ting Ho, Chris Choe, Christos Aridas, Clément Doumouro, Cole Smith, Connossor, Corey Levinson, Dan Ellis, Dan Stine, Danylo Baibak, daten-kieker, Denis Kataev, Didi Bar-Zev, Dillon Gardner, Dmitry Mottl, Dmitry Vukolov, Dougal J. Sutherland, Dowon, drewmjohnston, Dror Atariah, Edward J Brown, Ekaterina Krivich, Elizabeth Sander, Emmanuel Arias, Eric Chang, Eric Larson, Erich Schubert, esvhd, Falak, Feda Curic, Federico Caselli, Frank Hoang, Fibinse Xavier`, Finn O'Shea, Gabriel Marzinotto, Gabriel Vacaliuc, Gabriele Calvo, Gael Varoquaux, GauravAhlawat, Giuseppe Vettigli, Greg Gandenberger, Guillaume Fournier, Guillaume Lemaitre, Gustavo De Mari Pereira, Hanmin Qin, haroldfox, hhu-luqi, Hunter McGushion, Ian Sanders, JackLangerman, Jacopo Notarstefano, jakirkham, James Bourbeau, Jan Koch, Jan S, janvanrijn, Jarrod Millman, jdethurens, jeremiedbb, JF, joaak, Joan Massich, Joel Nothman, Jonathan Ohayon, Joris Van den Bossche, josephsalmon, Jérémie Méhault, Katrin Leinweber, ken, kms15, Koen, Kossori Aruku, Krishna Sangeeth, Kuai Yu, Kulbear, Kushal Chauhan, Kyle Jackson, Lakshya KD, Leandro Hermida, Lee Yi Jie Joel, Lily Xiong, Lisa Sarah Thomas, Loic Esteve, louib, luk-f-a, maikia, mail-liam, Manimaran, Manuel López-Ibáñez, Marc Torrellas, Marco Gaido, Marco Gorelli, MarcoGorelli, marineLM, Mark Hannel, Martin Gubri, Masstran, mathurinm, Matthew Roeschke, Max Copeland, melsyt, mferrari3, Mickaël Schoentgen, Ming Li, Mitar, Mohammad Aftab, Mohammed AbdelAal, Mohammed Ibraheem, Muhammad Hassaan Rafique, mwestt, Naoya Iijima, Nicholas Smith, Nicolas Goix, Nicolas Hug, Nikolay Shebanov, Oleksandr Pavlyk, Oliver Rausch, Olivier Grisel, Orestis, Osman, Owen Flanagan, Paul Paczuski, Pavel Soriano, pavlos kallis, Pawel Sendyk, peay, Peter, Peter Cock, Peter Hausamann, Peter Marko, Pierre Glaser, pierretallotte, Pim de Haan, Piotr Szymański, Prabakaran Kumaresshan, Pradeep Reddy Raamana, Prathmesh Savale, Pulkit Maloo, Quentin Batista, Radostin Stoyanov, Raf Baluyot, Rajdeep Dua, Ramil Nugmanov, Raúl García Calvo, Rebekah Kim, Reshama Shaikh, Rohan Lekhwani, Rohan Singh, Rohan Varma, Rohit Kapoor, Roman Feldbauer, Roman Yurchak, Romuald M, Roopam Sharma, Ryan, Rüdiger Busche, Sam Waterbury, Samuel O. Ronsin, SandroCasagrande, Scott Cole, Scott Lowe, Sebastian Raschka, Shangwu Yao, Shivam Kotwalia, Shiyu Duan, smarie, Sriharsha Hatwar, Stephen Hoover, Stephen Tierney, Stéphane Couvreur, surgan12, SylvainLan, TakingItCasual, Tashay Green, thibsej, Thomas Fan, Thomas J Fan, Thomas Moreau, Tom Dupré la Tour, Tommy, Tulio Casagrande, Umar Farouk Umar, Utkarsh Upadhyay, Vinayak Mehta, Vishaal Kapoor, Vivek Kumar, Vlad Niculae, vqean3, Wenhao Zhang, William de Vazelhes, xhan, Xing Han Lu, xinyuliu12, Yaroslav Halchenko, Zach Griffith, Zach Miller, Zayd Hammoudeh, Zhuyi Xue, Zijie (ZJ) Poh, ^__^