Version 0.20
scikit-learn Docs · نسخهٔ 5e9184e53cd3 · BSD-3-Clause
============
Version 0.20
Version 0.20 is the last version of scikit-learn to support Python 2.7 and Python 3.4. Scikit-learn 0.21 will require Python 3.5 or higher.
Version 0.20.4
July 30, 2019
This is a bug-fix release with some bug fixes applied to version 0.20.3.
Changelog
The bundled version of joblib was upgraded from 0.13.0 to 0.13.2.
sklearn.cluster ..............................
- |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.decomposition ............................
- |Fix| Fixed a bug in
cross_decomposition.CCAimproving numerical
stability when Y is close to zero. 13903 by Thomas Fan_.
sklearn.model_selection ..............................
- |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>`.
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.20.3
March 1, 2019
This is a bug-fix release with some minor documentation improvements and enhancements to features released in 0.20.0.
Changelog
sklearn.cluster ......................
- |Fix| Fixed a bug in
cluster.KMeanswhere computation was single
threaded when n_jobs > 1 or n_jobs = -1. 12949 by Prabakaran Kumaresshan <nixphix>.
sklearn.compose ......................
- |Fix| Fixed a bug in
compose.ColumnTransformerto handle
negative indexes in the columns list of the transformers. 12946 by Pierre Tallotte <pierretallotte>.
sklearn.covariance .........................
- |Fix| Fixed a regression in
covariance.graphical_lassoso that
the case n_features=2 is handled correctly. 13276 by Aurélien Bellet <bellet>.
sklearn.decomposition ............................
- |Fix| Fixed a bug in
decomposition.sparse_encodewhere computation was single
threaded when n_jobs > 1 or n_jobs = -1. 13005 by Prabakaran Kumaresshan <nixphix>.
sklearn.datasets ............................
- |Efficiency|
sklearn.datasets.fetch_openmlnow loads data by
streaming, avoiding high memory usage. 13312 by Joris Van den Bossche_.
sklearn.feature_extraction .................................
- |Fix| Fixed a bug in
feature_extraction.text.CountVectorizerwhich
would result in the sparse feature matrix having conflicting indptr and indices precisions under very large vocabularies. 11295 by Gabriel Vacaliuc <gvacaliuc>.
sklearn.impute .....................
- |Fix| add support for non-numeric data in
sklearn.impute.MissingIndicator which was not supported while sklearn.impute.SimpleImputer was supporting this for some imputation strategies. 13046 by Guillaume Lemaitre <glemaitre>.
sklearn.linear_model ...........................
- |Fix| Fixed a bug in
linear_model.MultiTaskElasticNetand
linear_model.MultiTaskLasso which were breaking when `warm_start = True. 12360 by Aakanksha Joshi <joaak>`.
sklearn.preprocessing ............................
- |Fix| Fixed a bug in
preprocessing.KBinsDiscretizerwhere
`strategy='kmeans' fails with an error during transformation due to unsorted bin edges. 13134 by Sandro Casagrande <SandroCasagrande>`.
- |Fix| Fixed a bug in
preprocessing.OneHotEncoderwhere the
deprecation of `categorical_features was handled incorrectly in combination with handle_unknown='ignore'. 12881 by Joris Van den Bossche`_.
- |Fix| Bins whose width are too small (i.e., <= 1e-8) are removed
with a warning in preprocessing.KBinsDiscretizer. 13165 by Hanmin Qin <qinhanmin2014>.
sklearn.svm ..................
- |FIX| Fixed a bug in
svm.SVC,svm.NuSVC,svm.SVR,
svm.NuSVR and svm.OneClassSVM where the `scale option of parameter gamma is erroneously defined as 1 / (n_features * X.std()). It's now defined as 1 / (n_features * X.var()). 13221 by Hanmin Qin <qinhanmin2014>`.
Code and Documentation Contributors
With thanks to:
Adrin Jalali, Agamemnon Krasoulis, Albert Thomas, Andreas Mueller, Aurélien Bellet, bertrandhaut, Bharat Raghunathan, Dowon, Emmanuel Arias, Fibinse Xavier, Finn O'Shea, Gabriel Vacaliuc, Gael Varoquaux, Guillaume Lemaitre, Hanmin Qin, joaak, Joel Nothman, Joris Van den Bossche, Jérémie Méhault, kms15, Kossori Aruku, Lakshya KD, maikia, Manuel López-Ibáñez, Marco Gorelli, MarcoGorelli, mferrari3, Mickaël Schoentgen, Nicolas Hug, pavlos kallis, Pierre Glaser, pierretallotte, Prabakaran Kumaresshan, Reshama Shaikh, Rohit Kapoor, Roman Yurchak, SandroCasagrande, Tashay Green, Thomas Fan, Vishaal Kapoor, Zhuyi Xue, Zijie (ZJ) Poh
Version 0.20.2
December 20, 2018
This is a bug-fix release with some minor documentation improvements and enhancements to features released in 0.20.0.
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.
sklearn.neighborswhen `metric=='jaccard'` (bug fix)- use of `
'seuclidean'or'mahalanobis'` metrics in some cases (bug fix)
Changelog
sklearn.compose ......................
- |Fix| Fixed an issue in
compose.make_column_transformerwhich raises
unexpected error when columns is pandas Index or pandas Series. 12704 by Hanmin Qin <qinhanmin2014>.
sklearn.metrics ......................
- |Fix| Fixed a bug in
metrics.pairwise_distancesand
metrics.pairwise_distances_chunked where parameters `V of "seuclidean" and VI of "mahalanobis" metrics were computed after the data was split into chunks instead of being pre-computed on whole data. 12701 by Jeremie du Boisberranger <jeremiedbb>`.
sklearn.neighbors ........................
- |Fix| Fixed
sklearn.neighbors.DistanceMetricjaccard distance
function to return 0 when two all-zero vectors are compared. 12685 by Thomas Fan <thomasjpfan>.
sklearn.utils ....................
- |Fix| Calling
utils.check_arrayonpandas.Serieswith categorical
data, which raised an error in 0.20.0, now returns the expected output again. 12699 by Joris Van den Bossche_.
Code and Documentation Contributors
With thanks to:
adanhawth, Adrin Jalali, Albert Thomas, Andreas Mueller, Dan Stine, Feda Curic, Hanmin Qin, Jan S, jeremiedbb, Joel Nothman, Joris Van den Bossche, josephsalmon, Katrin Leinweber, Loic Esteve, Muhammad Hassaan Rafique, Nicolas Hug, Olivier Grisel, Paul Paczuski, Reshama Shaikh, Sam Waterbury, Shivam Kotwalia, Thomas Fan
Version 0.20.1
November 21, 2018
This is a bug-fix release with some minor documentation improvements and enhancements to features released in 0.20.0. Note that we also include some API changes in this release, so you might get some extra warnings after updating from 0.20.0 to 0.20.1.
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.
decomposition.IncrementalPCA(bug fix)
Changelog
sklearn.cluster ......................
- |Efficiency| make
cluster.MeanShiftno longer try to do nested
parallelism as the overhead would hurt performance significantly when `n_jobs > 1. 12159 by Olivier Grisel <ogrisel>`.
- |Fix| Fixed a bug in
cluster.DBSCANwith precomputed sparse neighbors
graph, which would add explicitly zeros on the diagonal even when already present. 12105 by Tom Dupre la Tour_.
sklearn.compose ......................
- |Fix| Fixed an issue in
compose.ColumnTransformerwhen stacking
columns with types not convertible to a numeric. 11912 by Adrin Jalali <adrinjalali>.
- |API|
compose.ColumnTransformernow applies the `sparse_threshold`
even if all transformation results are sparse. 12304 by Andreas Müller_.
- |API|
compose.make_column_transformernow expects
`(transformer, columns) instead of (columns, transformer) to keep consistent with compose.ColumnTransformer. 12339 by Adrin Jalali <adrinjalali>`.
sklearn.datasets ............................
- |Fix|
datasets.fetch_openmlto correctly use the local cache.
12246 by Jan N. van Rijn <janvanrijn>.
- |Fix|
datasets.fetch_openmlto correctly handle ignore attributes and
row id attributes. 12330 by Jan N. van Rijn <janvanrijn>.
- |Fix| Fixed integer overflow in
datasets.make_classification
for values of `n_informative parameter larger than 64. 10811 by Roman Feldbauer <VarIr>`.
- |Fix| Fixed olivetti faces dataset `
DESCR` attribute to point to the right
location in datasets.fetch_olivetti_faces. 12441 by Jérémie du Boisberranger <jeremiedbb>
- |Fix|
datasets.fetch_openmlto retry downloading when reading
from local cache fails. 12517 by Thomas Fan <thomasjpfan>.
sklearn.decomposition ............................
- |Fix| Fixed a regression in
decomposition.IncrementalPCAwhere
0.20.0 raised an error if the number of samples in the final batch for fitting IncrementalPCA was smaller than n_components. 12234 by Ming Li <minggli>.
sklearn.ensemble .......................
- |Fix| Fixed a bug mostly affecting
ensemble.RandomForestClassifier
where `class_weight='balanced_subsample' failed with more than 32 classes. 12165 by Joel Nothman`_.
- |Fix| Fixed a bug affecting
ensemble.BaggingClassifier,
ensemble.BaggingRegressor and ensemble.IsolationForest, where `max_features was sometimes rounded down to zero. 12388 by Connor Tann <Connossor>`.
sklearn.feature_extraction ..................................
- |Fix| Fixed a regression in v0.20.0 where
feature_extraction.text.CountVectorizer and other text vectorizers could error during stop words validation with custom preprocessors or tokenizers. 12393 by Roman Yurchak_.
sklearn.linear_model ...........................
- |Fix|
linear_model.SGDClassifierand variants
with `early_stopping=True would not use a consistent validation split in the multiclass case and this would cause a crash when using those estimators as part of parallel parameter search or cross-validation. 12122 by Olivier Grisel <ogrisel>`.
- |Fix| Fixed a bug affecting
linear_model.SGDClassifierin the multiclass
case. Each one-versus-all step is run in a joblib.Parallel call and mutating a common parameter, causing a segmentation fault if called within a backend using processes and not threads. We now use `require=sharedmem at the joblib.Parallel instance creation. 12518 by Pierre Glaser <pierreglaser> and Olivier Grisel <ogrisel>`.
sklearn.metrics ......................
- |Fix| Fixed a bug in
metrics.pairwise.pairwise_distances_argmin_min
which returned the square root of the distance when the metric parameter was set to "euclidean". 12481 by Jérémie du Boisberranger <jeremiedbb>.
- |Fix| Fixed a bug in
metrics.pairwise.pairwise_distances_chunked
which didn't ensure the diagonal is zero for euclidean distances. 12612 by Andreas Müller <amueller>.
- |API| The
metrics.calinski_harabaz_scorehas been renamed to
metrics.calinski_harabasz_score and will be removed in version 0.23. 12211 by Lisa Thomas <LisaThomas9>, Mark Hannel <markhannel> and Melissa Ferrari <mferrari3>.
sklearn.mixture ........................
- |Fix| Ensure that the `
fit_predict` method of
mixture.GaussianMixture and mixture.BayesianGaussianMixture always yield assignments consistent with `fit followed by predict even if the convergence criterion is too loose or not met. 12451 by Olivier Grisel <ogrisel>`.
sklearn.neighbors ........................
- |Fix| force the parallelism backend to
threadingfor
neighbors.KDTree and neighbors.BallTree in Python 2.7 to avoid pickling errors caused by the serialization of their methods. 12171 by Thomas Moreau <tomMoral>.
sklearn.preprocessing .............................
- |Fix| Fixed bug in
preprocessing.OrdinalEncoderwhen passing
manually specified categories. 12365 by Joris Van den Bossche_.
- |Fix| Fixed bug in
preprocessing.KBinsDiscretizerwhere the
`transform method mutates the _encoder attribute. The transform method is now thread safe. 12514 by Hanmin Qin <qinhanmin2014>`.
- |Fix| Fixed a bug in
preprocessing.PowerTransformerwhere the
Yeo-Johnson transform was incorrect for lambda parameters outside of [0, 2] 12522 by Nicolas Hug<NicolasHug>.
- |Fix| Fixed a bug in
preprocessing.OneHotEncoderwhere transform
failed when set to ignore unknown numpy strings of different lengths 12471 by Gabriel Marzinotto<GMarzinotto>.
- |API| The default value of the
methodargument in
preprocessing.power_transform will be changed from box-cox to yeo-johnson to match preprocessing.PowerTransformer in version 0.23. A FutureWarning is raised when the default value is used. 12317 by Eric Chang <chang>.
sklearn.utils ........................
- |Fix| Use float64 for mean accumulator to avoid floating point
precision issues in preprocessing.StandardScaler and decomposition.IncrementalPCA when using float32 datasets. 12338 by bauks <bauks>.
- |Fix| Calling
utils.check_arrayonpandas.Series, which
raised an error in 0.20.0, now returns the expected output again. 12625 by Andreas Müller_
Miscellaneous .............
- |Fix| When using site joblib by setting the environment variable
SKLEARN_SITE_JOBLIB, added compatibility with joblib 0.11 in addition to 0.12+. 12350 by Joel Nothman_ and Roman Yurchak_.
- |Fix| Make sure to avoid raising `
FutureWarning` when calling
`np.vstack with numpy 1.16 and later (use list comprehensions instead of generator expressions in many locations of the scikit-learn code base). 12467 by Olivier Grisel <ogrisel>`.
- |API| Removed all mentions of `
sklearn.externals.joblib`, and deprecated
joblib methods exposed in `sklearn.utils, except for utils.parallel_backend and utils.register_parallel_backend, which allow users to configure parallel computation in scikit-learn. Other functionalities are part of joblib <https://joblib.readthedocs.io/>_. package and should be used directly, by installing it. The goal of this change is to prepare for unvendoring joblib in future version of scikit-learn. 12345 by Thomas Moreau <tomMoral>`
Code and Documentation Contributors
With thanks to:
^__^, Adrin Jalali, Andrea Navarrete, Andreas Mueller, bauks, BenjaStudio, Cheuk Ting Ho, Connossor, Corey Levinson, Dan Stine, daten-kieker, Denis Kataev, Dillon Gardner, Dmitry Vukolov, Dougal J. Sutherland, Edward J Brown, Eric Chang, Federico Caselli, Gabriel Marzinotto, Gael Varoquaux, GauravAhlawat, Gustavo De Mari Pereira, Hanmin Qin, haroldfox, JackLangerman, Jacopo Notarstefano, janvanrijn, jdethurens, jeremiedbb, Joel Nothman, Joris Van den Bossche, Koen, Kushal Chauhan, Lee Yi Jie Joel, Lily Xiong, mail-liam, Mark Hannel, melsyt, Ming Li, Nicholas Smith, Nicolas Hug, Nikolay Shebanov, Oleksandr Pavlyk, Olivier Grisel, Peter Hausamann, Pierre Glaser, Pulkit Maloo, Quentin Batista, Radostin Stoyanov, Ramil Nugmanov, Rebekah Kim, Reshama Shaikh, Rohan Singh, Roman Feldbauer, Roman Yurchak, Roopam Sharma, Sam Waterbury, Scott Lowe, Sebastian Raschka, Stephen Tierney, SylvainLan, TakingItCasual, Thomas Fan, Thomas Moreau, Tom Dupré la Tour, Tulio Casagrande, Utkarsh Upadhyay, Xing Han Lu, Yaroslav Halchenko, Zach Miller
Version 0.20.0
September 25, 2018
This release packs in a mountain of bug fixes, features and enhancements for the Scikit-learn library, and improvements to the documentation and examples. Thanks to our contributors!
This release is dedicated to the memory of Raghav Rajagopalan.
Highlights
We have tried to improve our support for common data-science use-cases including missing values, categorical variables, heterogeneous data, and features/targets with unusual distributions. Missing values in features, represented by NaNs, are now accepted in column-wise preprocessing such as scalers. Each feature is fitted disregarding NaNs, and data containing NaNs can be transformed. The new sklearn.impute module provides estimators for learning despite missing data.
~compose.ColumnTransformer handles the case where different features or columns of a pandas.DataFrame need different preprocessing. String or pandas Categorical columns can now be encoded with ~preprocessing.OneHotEncoder or ~preprocessing.OrdinalEncoder.
~compose.TransformedTargetRegressor helps when the regression target needs to be transformed to be modeled. ~preprocessing.PowerTransformer and ~preprocessing.KBinsDiscretizer join ~preprocessing.QuantileTransformer as non-linear transformations.
Beyond this, we have added sample_weight support to several estimators (including ~cluster.KMeans, ~linear_model.BayesianRidge and ~neighbors.KernelDensity) and improved stopping criteria in others (including ~neural_network.MLPRegressor, ~ensemble.GradientBoostingRegressor and ~linear_model.SGDRegressor).
This release is also the first to be accompanied by a glossary developed by Joel Nothman_. The glossary is a reference resource to help users and contributors become familiar with the terminology and conventions used in Scikit-learn.
Sorry if your contribution didn't make it into the highlights. There's a lot here...
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.
cluster.MeanShift(bug fix)decomposition.IncrementalPCAin Python 2 (bug fix)decomposition.SparsePCA(bug fix)ensemble.GradientBoostingClassifier(bug fix affecting feature importances)isotonic.IsotonicRegression(bug fix)linear_model.ARDRegression(bug fix)linear_model.LogisticRegressionCV(bug fix)linear_model.OrthogonalMatchingPursuit(bug fix)linear_model.PassiveAggressiveClassifier(bug fix)linear_model.PassiveAggressiveRegressor(bug fix)linear_model.Perceptron(bug fix)linear_model.SGDClassifier(bug fix)linear_model.SGDRegressor(bug fix)metrics.roc_auc_score(bug fix)metrics.roc_curve(bug fix)neural_network.BaseMultilayerPerceptron(bug fix)neural_network.MLPClassifier(bug fix)neural_network.MLPRegressor(bug fix)- The v0.19.0 release notes failed to mention a backwards incompatibility with
model_selection.StratifiedKFold when `shuffle=True due to 7823`.
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
11924:linear_model.LogisticRegressionCVwith
solver='lbfgs' and multi_class='multinomial' may be non-deterministic or otherwise broken on macOS. This appears to be the case on Travis CI servers, but has not been confirmed on personal MacBooks! This issue has been present in previous releases.
9354:metrics.pairwise.euclidean_distances(which is used
several times throughout the library) gives results with poor precision, which particularly affects its use with 32-bit float inputs. This became more problematic in versions 0.18 and 0.19 when some algorithms were changed to avoid casting 32-bit data into 64-bit.
Changelog
Support for Python 3.3 has been officially dropped.
sklearn.cluster ......................
- |MajorFeature|
cluster.AgglomerativeClusteringnow supports Single
Linkage clustering via `linkage='single'. 9372 by :user:Leland McInnes <lmcinnes> and Steve Astels <sastels>`.
- |Feature|
cluster.KMeansandcluster.MiniBatchKMeansnow support
sample weights via new parameter `sample_weight in fit function. 10933 by Johannes Hansen <jnhansen>`.
- |Efficiency|
cluster.KMeans,cluster.MiniBatchKMeansand
cluster.k_means passed with `algorithm='full' now enforce row-major ordering, improving runtime. 10471 by Gaurav Dhingra <gxyd>`.
- |Efficiency|
cluster.DBSCANnow is parallelized according to `n_jobs`
regardless of `algorithm. 8003 by Joël Billaud <recamshak>`.
- |Enhancement|
cluster.KMeansnow gives a warning if the number of
distinct clusters found is smaller than `n_clusters. This may occur when the number of distinct points in the data set is actually smaller than the number of cluster one is looking for. 10059 by Christian Braune <christianbraune79>`.
- |Fix| Fixed a bug where the `
fit` method of
cluster.AffinityPropagation stored cluster centers as 3d array instead of 2d array in case of non-convergence. For the same class, fixed undefined and arbitrary behavior in case of training data where all samples had equal similarity. 9612. By Jonatan Samoocha <jsamoocha>.
- |Fix| Fixed a bug in
cluster.spectral_clusteringwhere the normalization of
the spectrum was using a division instead of a multiplication. 8129 by Jan Margeta <jmargeta>, Guillaume Lemaitre <glemaitre>, and Devansh D. <devanshdalal>.
- |Fix| Fixed a bug in
cluster.k_means_elkanwhere the returned
`iteration was 1 less than the correct value. Also added the missing n_iter_ attribute in the docstring of cluster.KMeans. 11353 by Jeremie du Boisberranger <jeremiedbb>`.
- |Fix| Fixed a bug in
cluster.mean_shiftwhere the assigned labels
were not deterministic if there were multiple clusters with the same intensities. 11901 by Adrin Jalali <adrinjalali>.
- |API| Deprecate `
pooling_func` unused parameter in
cluster.AgglomerativeClustering. 9875 by Kumar Ashutosh <thechargedneutron>.
sklearn.compose ......................
- New module.
- |MajorFeature| Added
compose.ColumnTransformer, which allows to
apply different transformers to different columns of arrays or pandas DataFrames. 9012 by Andreas Müller_ and Joris Van den Bossche_, and 11315 by Thomas Fan <thomasjpfan>.
- |MajorFeature| Added the
compose.TransformedTargetRegressorwhich
transforms the target y before fitting a regression model. The predictions are mapped back to the original space via an inverse transform. 9041 by Andreas Müller_ and Guillaume Lemaitre <glemaitre>.
sklearn.covariance .........................
- |Efficiency| Runtime improvements to
covariance.GraphicalLasso.
9858 by Steven Brown <stevendbrown>.
- |API| The
covariance.graph_lasso,
covariance.GraphLasso and covariance.GraphLassoCV have been renamed to covariance.graphical_lasso, covariance.GraphicalLasso and covariance.GraphicalLassoCV respectively and will be removed in version 0.22. 9993 by Artiem Krinitsyn <artiemq>
sklearn.datasets .......................
- |MajorFeature| Added
datasets.fetch_openmlto fetch datasets from
OpenML <https://openml.org>_. OpenML is a free, open data sharing platform and will be used instead of mldata as it provides better service availability. 9908 by Andreas Müller_ and Jan N. van Rijn <janvanrijn>.
- |Feature| In
datasets.make_blobs, one can now pass a list to the
`n_samples parameter to indicate the number of samples to generate per cluster. 8617 by Maskani Filali Mohamed <maskani-moh> and Konstantinos Katrioplas <kkatrio>`.
- |Feature| Add `
filenameattribute tosklearn.datasets` that have a CSV file.
9101 by alex-33 <alex-33> and Maskani Filali Mohamed <maskani-moh>.
- |Feature| `
return_X_y` parameter has been added to several dataset loaders.
10774 by Chris Catalfo <ccatalfo>.
- |Fix| Fixed a bug in
datasets.load_bostonwhich had a wrong data
point. 10795 by Takeshi Yoshizawa <tarcusx>.
- |Fix| Fixed a bug in
datasets.load_iriswhich had two wrong data points.
11082 by Sadhana Srinivasan <rotuna> and Hanmin Qin <qinhanmin2014>.
- |Fix| Fixed a bug in
datasets.fetch_kddcup99, where data were not
properly shuffled. 9731 by Nicolas Goix_.
- |Fix| Fixed a bug in
datasets.make_circles, where no odd number of
data points could be generated. 10045 by :user:Christian Braune <christianbraune79>.
- |API| Deprecated
sklearn.datasets.fetch_mldatato be removed in
version 0.22. mldata.org is no longer operational. Until removal it will remain possible to load cached datasets. 11466 by Joel Nothman_.
sklearn.decomposition ............................
- |Feature|
decomposition.dict_learningfunctions and models now
support positivity constraints. This applies to the dictionary and sparse code. 6374 by John Kirkham <jakirkham>.
- |Feature| |Fix|
decomposition.SparsePCAnow exposes
`normalize_components. When set to True, the train and test data are centered with the train mean respectively during the fit phase and the transform phase. This fixes the behavior of SparsePCA. When set to False, which is the default, the previous abnormal behaviour still holds. The False value is for backward compatibility and should not be used. 11585 by Ivan Panico <FollowKenny>`.
- |Efficiency| Efficiency improvements in
decomposition.dict_learning.
11420 and others by John Kirkham <jakirkham>.
- |Fix| Fix for uninformative error in
decomposition.IncrementalPCA:
now an error is raised if the number of components is larger than the chosen batch size. The `n_components=None case was adapted accordingly. 6452. By Wally Gauze <wallygauze>`.
- |Fix| Fixed a bug where the `
partial_fit` method of
decomposition.IncrementalPCA used integer division instead of float division on Python 2. 9492 by James Bourbeau <jrbourbeau>.
- |Fix| In
decomposition.PCAselecting a n_components parameter greater
than the number of samples now raises an error. Similarly, the `n_components=None case now selects the minimum of n_samples and n_features. 8484 by Wally Gauze <wallygauze>`.
- |Fix| Fixed a bug in
decomposition.PCAwhere users will get
unexpected error with large datasets when `n_components='mle' on Python 3 versions. 9886 by Hanmin Qin <qinhanmin2014>`.
- |Fix| Fixed an underflow in calculating KL-divergence for
decomposition.NMF 10142 by Tom Dupre la Tour_.
- |Fix| Fixed a bug in
decomposition.SparseCoderwhen running OMP
sparse coding in parallel using read-only memory mapped datastructures. 5956 by Vighnesh Birodkar <vighneshbirodkar> and Olivier Grisel <ogrisel>.
sklearn.discriminant_analysis ....................................
- |Efficiency| Memory usage improvement for
_class_meansand
_class_cov in sklearn.discriminant_analysis. 10898 by Nanxin Chen <bobchennan>.
sklearn.dummy ....................
- |Feature|
dummy.DummyRegressornow has a `return_std` option in its
`predict` method. The returned standard deviations will be zeros.
- |Feature|
dummy.DummyClassifieranddummy.DummyRegressornow
only require X to be an object with finite length or shape. 9832 by Vrishank Bhardwaj <vrishank97>.
- |Feature|
dummy.DummyClassifieranddummy.DummyRegressor
can now be scored without supplying test samples. 11951 by Rüdiger Busche <JarnoRFB>.
sklearn.ensemble .......................
- |Feature|
ensemble.BaggingRegressorand
ensemble.BaggingClassifier can now be fit with missing/non-finite values in X and/or multi-output Y to support wrapping pipelines that perform their own imputation. 9707 by Jimmy Wan <jimmywan>.
- |Feature|
ensemble.GradientBoostingClassifierand
ensemble.GradientBoostingRegressor now support early stopping via `n_iter_no_change, validation_fraction and tol. 7071 by Raghav RV`_
- |Feature| Added `
named_estimators_` parameter in
ensemble.VotingClassifier to access fitted estimators. 9157 by Herilalaina Rakotoarison <herilalaina>.
- |Fix| Fixed a bug when fitting
ensemble.GradientBoostingClassifieror
ensemble.GradientBoostingRegressor with `warm_start=True which previously raised a segmentation fault due to a non-conversion of CSC matrix into CSR format expected by decision_function. Similarly, Fortran-ordered arrays are converted to C-ordered arrays in the dense case. 9991 by Guillaume Lemaitre <glemaitre>`.
- |Fix| Fixed a bug in
ensemble.GradientBoostingRegressor
and ensemble.GradientBoostingClassifier to have feature importances summed and then normalized, rather than normalizing on a per-tree basis. The previous behavior over-weighted the Gini importance of features that appear in later stages. This issue only affected feature importances. 11176 by Gil Forsyth <gforsyth>.
- |API| The default value of the `
n_estimators` parameter of
ensemble.RandomForestClassifier, ensemble.RandomForestRegressor, ensemble.ExtraTreesClassifier, ensemble.ExtraTreesRegressor, and ensemble.RandomTreesEmbedding will change from 10 in version 0.20 to 100 in 0.22. A FutureWarning is raised when the default value is used. 11542 by Anna Ayzenshtat <annaayzenshtat>.
- |API| Classes derived from
ensemble.BaseBagging. The attribute
`estimators_samples_ will return a list of arrays containing the indices selected for each bootstrap instead of a list of arrays containing the mask of the samples selected for each bootstrap. Indices allows to repeat samples while mask does not allow this functionality. 9524 by Guillaume Lemaitre <glemaitre>`.
- |Fix|
ensemble.BaseBaggingwhere one could not deterministically
reproduce `fit result using the object attributes when random_state is set. 9723 by Guillaume Lemaitre <glemaitre>`.
sklearn.feature_extraction .................................
- |Feature| Enable the call to
get_feature_namesin unfitted
feature_extraction.text.CountVectorizer initialized with a vocabulary. 10908 by Mohamed Maskani <maskani-moh>.
- |Enhancement| `
idf_` can now be set on a
feature_extraction.text.TfidfTransformer. 10899 by Sergey Melderis <serega>.
- |Fix| Fixed a bug in
feature_extraction.image.extract_patches_2dwhich
would throw an exception if `max_patches was greater than or equal to the number of all possible patches rather than simply returning the number of possible patches. 10101 by Varun Agrawal <varunagrawal>`
- |Fix| Fixed a bug in
feature_extraction.text.CountVectorizer,
feature_extraction.text.TfidfVectorizer, feature_extraction.text.HashingVectorizer to support 64 bit sparse array indexing necessary to process large datasets with more than 2·10⁹ tokens (words or n-grams). 9147 by Claes-Fredrik Mannby <mannby> and Roman Yurchak_.
- |Fix| Fixed bug in
feature_extraction.text.TfidfVectorizerwhich
was ignoring the parameter `dtype. In addition, feature_extraction.text.TfidfTransformer will preserve dtype for floating and raise a warning if dtype requested is integer. 10441 by Mayur Kulkarni <maykulkarni> and Guillaume Lemaitre <glemaitre>`.
sklearn.feature_selection ................................
- |Feature| Added select K best features functionality to
feature_selection.SelectFromModel. 6689 by Nihar Sheth <nsheth12> and Quazi Rahman <qmaruf>.
- |Feature| Added `
min_features_to_select` parameter to
feature_selection.RFECV to bound evaluated features counts. 11293 by Brent Yi <brentyi>.
- |Feature|
feature_selection.RFECV's fit method now supports
groups. 9656 by Adam Greenhall <adamgreenhall>.
- |Fix| Fixed computation of `
n_features_to_compute` for edge case with tied
CV scores in feature_selection.RFECV. 9222 by Nick Hoh <nickypie>.
sklearn.gaussian_process ...............................
- |Efficiency| In
gaussian_process.GaussianProcessRegressor, method
`predict is faster when using return_std=True in particular more when called several times in a row. 9234 by andrewww <andrewww> and Minghui Liu <minghui-liu>`.
sklearn.impute .....................
- New module, adopting `
preprocessing.Imputer` as
impute.SimpleImputer with minor changes (see under preprocessing below).
- |MajorFeature| Added
impute.MissingIndicatorwhich generates a
binary indicator for missing values. 8075 by :user:Maniteja Nandana <maniteja123> and Guillaume Lemaitre <glemaitre>.
- |Feature| The
impute.SimpleImputerhas a new strategy,
`'constant', to complete missing values with a fixed one, given by the fill_value parameter. This strategy supports numeric and non-numeric data, and so does the 'most_frequent' strategy now. 11211 by Jeremie du Boisberranger <jeremiedbb>`.
sklearn.isotonic .......................
- |Fix| Fixed a bug in
isotonic.IsotonicRegressionwhich incorrectly
combined weights when fitting a model to data involving points with identical X values. 9484 by Dallas Card <dallascard>
sklearn.linear_model ...........................
- |Feature|
linear_model.SGDClassifier,
linear_model.SGDRegressor, linear_model.PassiveAggressiveClassifier, linear_model.PassiveAggressiveRegressor and linear_model.Perceptron now expose `early_stopping, validation_fraction and n_iter_no_change parameters, to stop optimization monitoring the score on a validation set. A new learning rate "adaptive" strategy divides the learning rate by 5 each time n_iter_no_change consecutive epochs fail to improve the model. 9043 by Tom Dupre la Tour`_.
- |Feature| Add
sample_weightparameter to the fit method of
linear_model.BayesianRidge for weighted linear regression. 10112 by Peter St. John <pstjohn>.
- |Fix| Fixed a bug in
logistic.logistic_regression_pathto ensure
that the returned coefficients are correct when `multiclass='multinomial'. Previously, some of the coefficients would override each other, leading to incorrect results in linear_model.LogisticRegressionCV. 11724 by Nicolas Hug <NicolasHug>`.
- |Fix| Fixed a bug in
linear_model.LogisticRegressionwhere when using
the parameter `multi_class='multinomial', the predict_proba method was returning incorrect probabilities in the case of binary outcomes. 9939 by Roger Westover <rwolst>`.
- |Fix| Fixed a bug in
linear_model.LogisticRegressionCVwhere the
`score method always computes accuracy, not the metric given by the scoring parameter. 10998 by Thomas Fan <thomasjpfan>`.
- |Fix| Fixed a bug in
linear_model.LogisticRegressionCVwhere the
'ovr' strategy was always used to compute cross-validation scores in the multiclass setting, even if `'multinomial' was set. 8720 by William de Vazelhes <wdevazelhes>`.
- |Fix| Fixed a bug in
linear_model.OrthogonalMatchingPursuitthat was
broken when setting `normalize=False. 10071 by Alexandre Gramfort`_.
- |Fix| Fixed a bug in
linear_model.ARDRegressionwhich caused
incorrectly updated estimates for the standard deviation and the coefficients. 10153 by Jörg Döpfert <jdoepfert>.
- |Fix| Fixed a bug in
linear_model.ARDRegressionand
linear_model.BayesianRidge which caused NaN predictions when fitted with a constant target. 10095 by Jörg Döpfert <jdoepfert>.
- |Fix| Fixed a bug in
linear_model.RidgeClassifierCVwhere
the parameter `store_cv_values was not implemented though it was documented in cv_values as a way to set up the storage of cross-validation values for different alphas. 10297 by Mabel Villalba-Jiménez <mabelvj>`.
- |Fix| Fixed a bug in
linear_model.ElasticNetwhich caused the input
to be overridden when using parameter `copy_X=True and check_input=False. 10581 by Yacine Mazari <ymazari>`.
- |Fix| Fixed a bug in
sklearn.linear_model.Lasso
where the coefficient had wrong shape when `fit_intercept=False. 10687 by Martin Hahn <martin-hahn>`.
- |Fix| Fixed a bug in
sklearn.linear_model.LogisticRegressionwhere the
`multi_class='multinomial' with binary output with warm_start=True 10836 by Aishwarya Srinivasan <aishgrt1>`.
- |Fix| Fixed a bug in
linear_model.RidgeCVwhere using integer
`alphas raised an error. 10397 by Mabel Villalba-Jiménez <mabelvj>`.
- |Fix| Fixed condition triggering gap computation in
linear_model.Lasso and linear_model.ElasticNet when working with sparse matrices. 10992 by Alexandre Gramfort_.
- |Fix| Fixed a bug in
linear_model.SGDClassifier,
linear_model.SGDRegressor, linear_model.PassiveAggressiveClassifier, linear_model.PassiveAggressiveRegressor and linear_model.Perceptron, where the stopping criterion was stopping the algorithm before convergence. A parameter `n_iter_no_change was added and set by default to 5. Previous behavior is equivalent to setting the parameter to 1. 9043 by Tom Dupre la Tour`_.
- |Fix| Fixed a bug where liblinear and libsvm-based estimators would segfault
if passed a scipy.sparse matrix with 64-bit indices. They now raise a ValueError. 11327 by Karan Dhingra <kdhingra307> and Joel Nothman_.
- |API| The default values of the `
solverandmulti_class` parameters of
linear_model.LogisticRegression will change respectively from `'liblinear' and 'ovr' in version 0.20 to 'lbfgs' and 'auto' in version 0.22. A FutureWarning is raised when the default values are used. 11905 by Tom Dupre la Tour_ and Joel Nothman`_.
- |API| Deprecate `
positive=Trueoption inlinear_model.Lars` as
the underlying implementation is broken. Use linear_model.Lasso instead. 9837 by Alexandre Gramfort_.
- |API| `
n_iter_` may vary from previous releases in
linear_model.LogisticRegression with `solver='lbfgs' and linear_model.HuberRegressor. For Scipy <= 1.0.0, the optimizer could perform more than the requested maximum number of iterations. Now both estimators will report at most max_iter iterations even if more were performed. 10723 by Joel Nothman`_.
sklearn.manifold .......................
- |Efficiency| Speed improvements for both 'exact' and 'barnes_hut' methods in
manifold.TSNE. 10593 and 10610 by Tom Dupre la Tour_.
- |Feature| Support sparse input in
manifold.Isomap.fit.
8554 by Leland McInnes <lmcinnes>.
- |Feature|
manifold.t_sne.trustworthinessaccepts metrics other than
Euclidean. 9775 by William de Vazelhes <wdevazelhes>.
- |Fix| Fixed a bug in
manifold.spectral_embeddingwhere the
normalization of the spectrum was using a division instead of a multiplication. 8129 by Jan Margeta <jmargeta>, Guillaume Lemaitre <glemaitre>, and :user:Devansh D. <devanshdalal>.
- |API| |Feature| Deprecate `
precomputed` parameter in function
manifold.t_sne.trustworthiness. Instead, the new parameter `metric should be used with any compatible metric including 'precomputed', in which case the input matrix X should be a matrix of pairwise distances or squared distances. 9775 by :user:William de Vazelhes <wdevazelhes>`.
- |API| Deprecate `
precomputed` parameter in function
manifold.t_sne.trustworthiness. Instead, the new parameter `metric should be used with any compatible metric including 'precomputed', in which case the input matrix X should be a matrix of pairwise distances or squared distances. 9775 by William de Vazelhes <wdevazelhes>`.
sklearn.metrics ......................
- |MajorFeature| Added the
metrics.davies_bouldin_scoremetric for
evaluation of clustering models without a ground truth. 10827 by Luis Osa <logc>.
- |MajorFeature| Added the
metrics.balanced_accuracy_scoremetric and
a corresponding `'balanced_accuracy' scorer for binary and multiclass classification. 8066 by xyguo and :user:Aman Dalmia <dalmia>, and 10587 by Joel Nothman`_.
- |Feature| Partial AUC is available via `
max_fpr` parameter in
metrics.roc_auc_score. 3840 by Alexander Niederbühl <Alexander-N>.
- |Feature| A scorer based on
metrics.brier_score_lossis also
available. 9521 by Hanmin Qin <qinhanmin2014>.
- |Feature| Added control over the normalization in
metrics.normalized_mutual_info_score and metrics.adjusted_mutual_info_score via the `average_method parameter. In version 0.22, the default normalizer for each will become the *arithmetic* mean of the entropies of each clustering. 11124 by Arya McCarthy <aryamccarthy>`.
- |Feature| Added `
output_dictparameter inmetrics.classification_report`
to return classification statistics as dictionary. 11160 by Dan Barkhorn <danielbarkhorn>.
- |Feature|
metrics.classification_reportnow reports all applicable averages on
the given data, including micro, macro and weighted average as well as samples average for multilabel data. 11679 by Alexander Pacha <apacha>.
- |Feature|
metrics.average_precision_scorenow supports binary
`y_true other than {0, 1} or {-1, 1} through pos_label parameter. 9980 by Hanmin Qin <qinhanmin2014>`.
- |Feature|
metrics.label_ranking_average_precision_scorenow supports
`sample_weight. 10845 by Jose Perez-Parras Toledano <jopepato>`.
- |Feature| Add `
dense_outputparameter tometrics.pairwise.linear_kernel`.
When False and both inputs are sparse, will return a sparse matrix. 10999 by Taylor G Smith <tgsmith61591>.
- |Efficiency|
metrics.silhouette_scoreand
metrics.silhouette_samples are more memory efficient and run faster. This avoids some reported freezes and MemoryErrors. 11135 by Joel Nothman_.
- |Fix| Fixed a bug in
metrics.precision_recall_fscore_support
when truncated range(n_labels) is passed as value for labels. 10377 by Gaurav Dhingra <gxyd>.
- |Fix| Fixed a bug due to floating point error in
metrics.roc_auc_score with non-integer sample weights. 9786 by Hanmin Qin <qinhanmin2014>.
- |Fix| Fixed a bug where
metrics.roc_curvesometimes starts on y-axis
instead of (0, 0), which is inconsistent with the document and other implementations. Note that this will not influence the result from metrics.roc_auc_score 10093 by :user:alexryndin <alexryndin> and Hanmin Qin <qinhanmin2014>.
- |Fix| Fixed a bug to avoid integer overflow. Casted product to 64 bits integer in
metrics.mutual_info_score. 9772 by Kumar Ashutosh <thechargedneutron>.
- |Fix| Fixed a bug where
metrics.average_precision_scorewill sometimes return
`nan when sample_weight contains 0. 9980 by Hanmin Qin <qinhanmin2014>`.
- |Fix| Fixed a bug in
metrics.fowlkes_mallows_scoreto avoid integer
overflow. Casted return value of contingency_matrix to int64 and computed product of square roots rather than square root of product. 9515 by Alan Liddell <aliddell> and Manh Dao <manhdao>.
- |API| Deprecate `
reorderparameter inmetrics.auc` as it's no
longer required for metrics.roc_auc_score. Moreover using `reorder=True can hide bugs due to floating point error in the input. 9851 by Hanmin Qin <qinhanmin2014>`.
- |API| In
metrics.normalized_mutual_info_scoreand
metrics.adjusted_mutual_info_score, warn that `average_method will have a new default value. In version 0.22, the default normalizer for each will become the *arithmetic* mean of the entropies of each clustering. Currently, metrics.normalized_mutual_info_score uses the default of average_method='geometric', and metrics.adjusted_mutual_info_score uses the default of average_method='max' to match their behaviors in version 0.19. 11124 by Arya McCarthy <aryamccarthy>`.
- |API| The `
batch_sizeparameter tometrics.pairwise_distances_argmin_min`
and metrics.pairwise_distances_argmin is deprecated to be removed in v0.22. It no longer has any effect, as batch size is determined by global `working_memory config. See working_memory. 10280 by Joel Nothman_ and Aman Dalmia <dalmia>`.
sklearn.mixture ......................
- |Feature| Added function
fit_predicttomixture.GaussianMixture
and mixture.GaussianMixture, which is essentially equivalent to calling fit and predict. 10336 by :user:Shu Haoran <haoranShu> and Andrew Peng <Andrew-peng>.
- |Fix| Fixed a bug in
mixture.BaseMixturewhere the reportedn_iter_was
missing an iteration. It affected mixture.GaussianMixture and mixture.BayesianGaussianMixture. 10740 by :user:Erich Schubert <kno10> and Guillaume Lemaitre <glemaitre>.
- |Fix| Fixed a bug in
mixture.BaseMixtureand its subclasses
mixture.GaussianMixture and mixture.BayesianGaussianMixture where the `lower_bound_ was not the max lower bound across all initializations (when n_init > 1), but just the lower bound of the last initialization. 10869 by Aurélien Géron <ageron>`.
sklearn.model_selection ..............................
- |Feature| Add
return_estimatorparameter in
model_selection.cross_validate to return estimators fitted on each split. 9686 by Aurélien Bellet <bellet>.
- |Feature| New `
refit_time_` attribute will be stored in
model_selection.GridSearchCV and model_selection.RandomizedSearchCV if `refit is set to True. This will allow measuring the complete time it takes to perform hyperparameter optimization and refitting the best model on the whole dataset. 11310 by Matthias Feurer <mfeurer>`.
- |Feature| Expose
error_scoreparameter in
model_selection.cross_validate, model_selection.cross_val_score, model_selection.learning_curve and model_selection.validation_curve to control the behavior triggered when an error occurs in model_selection._fit_and_score. 11576 by Samuel O. Ronsin <samronsin>.
- |Feature|
BaseSearchCVnow has an experimental, private interface to
support customized parameter search strategies, through its `_run_search method. See the implementations in model_selection.GridSearchCV and model_selection.RandomizedSearchCV and please provide feedback if you use this. Note that we do not assure the stability of this API beyond version 0.20. 9599 by Joel Nothman`_
- |Enhancement| Add improved error message in
model_selection.cross_val_score when multiple metrics are passed in `scoring keyword. 11006 by Ming Li <minggli>`.
- |API| The default number of cross-validation folds `
cv` and the default
number of splits `n_splits in the model_selection.KFold-like splitters will change from 3 to 5 in 0.22 as 3-fold has a lot of variance. 11557 by Alexandre Boucaud <aboucaud>`.
- |API| The default of `
iidparameter ofmodel_selection.GridSearchCV`
and model_selection.RandomizedSearchCV will change from `True to False in version 0.22 to correspond to the standard definition of cross-validation, and the parameter will be removed in version 0.24 altogether. This parameter is of greatest practical significance where the sizes of different test sets in cross-validation were very unequal, i.e. in group-based CV strategies. 9085 by Laurent Direr <ldirer> and Andreas Müller`_.
- |API| The default value of the `
error_score` parameter in
model_selection.GridSearchCV and model_selection.RandomizedSearchCV will change to `np.NaN in version 0.22. 10677 by Kirill Zhdanovich <Zhdanovich>`.
- |API| Changed ValueError exception raised in
model_selection.ParameterSampler to a UserWarning for case where the class is instantiated with a greater value of `n_iter than the total space of parameters in the parameter grid. n_iter now acts as an upper bound on iterations. 10982 by Juliet Lawton <julietcl>`
- |API| Invalid input for
model_selection.ParameterGridnow
raises TypeError. 10928 by Solutus Immensus <solutusimmensus>
sklearn.multioutput ..........................
- |MajorFeature| Added
multioutput.RegressorChainfor multi-target
regression. 9257 by Kumar Ashutosh <thechargedneutron>.
sklearn.naive_bayes ..........................
- |MajorFeature| Added
naive_bayes.ComplementNB, which implements the
Complement Naive Bayes classifier described in Rennie et al. (2003). 8190 by Michael A. Alcorn <airalcorn2>.
- |Feature| Add
var_smoothingparameter innaive_bayes.GaussianNB
to give a precise control over variances calculation. 9681 by Dmitry Mottl <Mottl>.
- |Fix| Fixed a bug in
naive_bayes.GaussianNBwhich incorrectly
raised error for prior list which summed to 1. 10005 by Gaurav Dhingra <gxyd>.
- |Fix| Fixed a bug in
naive_bayes.MultinomialNBwhich did not accept
vector valued pseudocounts (alpha). 10346 by Tobias Madsen <TobiasMadsen>
sklearn.neighbors ........................
- |Efficiency|
neighbors.RadiusNeighborsRegressorand
neighbors.RadiusNeighborsClassifier are now parallelized according to `n_jobs regardless of algorithm. 10887 by Joël Billaud <recamshak>`.
- |Efficiency|
sklearn.neighborsquery methods are now more
memory efficient when `algorithm='brute'. 11136 by Joel Nothman_ and Aman Dalmia <dalmia>`.
- |Feature| Add `
sample_weight` parameter to the fit method of
neighbors.KernelDensity to enable weighting in kernel density estimation. 4394 by Samuel O. Ronsin <samronsin>.
- |Feature| Novelty detection with
neighbors.LocalOutlierFactor:
Add a `novelty parameter to neighbors.LocalOutlierFactor. When novelty is set to True, neighbors.LocalOutlierFactor can then be used for novelty detection, i.e. predict on new unseen data. Available prediction methods are predict, decision_function and score_samples. By default, novelty is set to False, and only the fit_predict method is available. By Albert Thomas <albertcthomas>`.
- |Fix| Fixed a bug in
neighbors.NearestNeighborswhere fitting a
NearestNeighbors model fails when a) the distance metric used is a callable and b) the input to the NearestNeighbors model is sparse. 9579 by Thomas Kober <tttthomasssss>.
- |Fix| Fixed a bug so `
predict` in
neighbors.RadiusNeighborsRegressor can handle empty neighbor set when using non uniform weights. Also raises a new warning when no neighbors are found for samples. 9655 by :user:Andreas Bjerre-Nielsen <abjer>.
- |Fix| |Efficiency| Fixed a bug in `
KDTree` construction that results in
faster construction and querying times. 11556 by Jake VanderPlas <jakevdp>
- |Fix| Fixed a bug in
neighbors.KDTreeandneighbors.BallTreewhere
pickled tree objects would change their type to the super class BinaryTree. 11774 by Nicolas Hug <NicolasHug>.
sklearn.neural_network .............................
- |Feature| Add
n_iter_no_changeparameter in
neural_network.BaseMultilayerPerceptron, neural_network.MLPRegressor, and neural_network.MLPClassifier to give control over maximum number of epochs to not meet `tol improvement. 9456 by Nicholas Nadeau <nnadeau>`.
- |Fix| Fixed a bug in
neural_network.BaseMultilayerPerceptron,
neural_network.MLPRegressor, and neural_network.MLPClassifier with new `n_iter_no_change parameter now at 10 from previously hardcoded 2. 9456 by Nicholas Nadeau <nnadeau>`.
- |Fix| Fixed a bug in
neural_network.MLPRegressorwhere fitting
quit unexpectedly early due to local minima or fluctuations. 9456 by Nicholas Nadeau <nnadeau>
sklearn.pipeline .......................
- |Feature| The `
predictmethod ofpipeline.Pipeline` now passes
keyword arguments on to the pipeline's last estimator, enabling the use of parameters such as `return_std in a pipeline with caution. 9304 by Breno Freitas <brenolf>`.
- |API|
pipeline.FeatureUnionnow supports `'drop'` as a transformer
to drop features. 11144 by Thomas Fan <thomasjpfan>.
sklearn.preprocessing ............................
- |MajorFeature| Expanded
preprocessing.OneHotEncoderto allow to
encode categorical string features as a numeric array using a one-hot (or dummy) encoding scheme, and added preprocessing.OrdinalEncoder to convert to ordinal integers. Those two classes now handle encoding of all feature types (also handles string-valued features) and derives the categories based on the unique values in the features instead of the maximum value in the features. 9151 and 10521 by :user:Vighnesh Birodkar <vighneshbirodkar> and Joris Van den Bossche_.
- |MajorFeature| Added
preprocessing.KBinsDiscretizerfor turning
continuous features into categorical or one-hot encoded features. 7668, 9647, 10195, 10192, 11272, 11467 and 11505. by Henry Lin <hlin117>, Hanmin Qin_, Tom Dupre la Tour_ and Giovanni Giuseppe Costa <ggc87>.
- |MajorFeature| Added
preprocessing.PowerTransformer, which
implements the Yeo-Johnson and Box-Cox power transformations. Power transformations try to find a set of feature-wise parametric transformations to approximately map data to a Gaussian distribution centered at zero and with unit variance. This is useful as a variance-stabilizing transformation in situations where normality and homoscedasticity are desirable. 10210 by Eric Chang <chang> and :user:Maniteja Nandana <maniteja123>, and 11520 by :user:Nicolas Hug <nicolashug>.
- |MajorFeature| NaN values are ignored and handled in the following
preprocessing methods: preprocessing.MaxAbsScaler, preprocessing.MinMaxScaler, preprocessing.RobustScaler, preprocessing.StandardScaler, preprocessing.PowerTransformer, preprocessing.QuantileTransformer classes and preprocessing.maxabs_scale, preprocessing.minmax_scale, preprocessing.robust_scale, preprocessing.scale, preprocessing.power_transform, preprocessing.quantile_transform functions respectively addressed in issues 11011, 11005, 11308, 11206, 11306, and 10437. By Lucija Gregov <LucijaGregov> and Guillaume Lemaitre <glemaitre>.
- |Feature|
preprocessing.PolynomialFeaturesnow supports sparse
input. 10452 by Aman Dalmia <dalmia> and Joel Nothman_.
- |Feature|
preprocessing.RobustScalerand
preprocessing.robust_scale can be fitted using sparse matrices. 11308 by Guillaume Lemaitre <glemaitre>.
- |Feature|
preprocessing.OneHotEncodernow supports the
get_feature_names method to obtain the transformed feature names. 10181 by Nirvan Anjirbag <Nirvan101> and Joris Van den Bossche_.
- |Feature| A parameter `
check_inverse` was added to
preprocessing.FunctionTransformer to ensure that `func and inverse_func are the inverse of each other. 9399 by Guillaume Lemaitre <glemaitre>`.
- |Feature| The `
transformmethod ofsklearn.preprocessing.MultiLabelBinarizer`
now ignores any unknown classes. A warning is raised stating the unknown classes classes found which are ignored. 10913 by Rodrigo Agundez <rragundez>.
- |Fix| Fixed bugs in
preprocessing.LabelEncoderwhich would
sometimes throw errors when `transform or inverse_transform was called with empty arrays. 10458 by Mayur Kulkarni <maykulkarni>`.
- |Fix| Fix ValueError in
preprocessing.LabelEncoderwhen using
`inverse_transform on unseen labels. 9816 by :user:Charlie Newey <newey01c>`.
- |Fix| Fix bug in
preprocessing.OneHotEncoderwhich discarded the
`dtype when returning a sparse matrix output. 11042 by Daniel Morales <DanielMorales9>`.
- |Fix| Fix `
fitandpartial_fit` in
preprocessing.StandardScaler in the rare case when `with_mean=False and with_std=False which was crashing by calling fit more than once and giving inconsistent results for mean_ whether the input was a sparse or a dense matrix. mean_ will be set to None with both sparse and dense inputs. n_samples_seen_ will be also reported for both input types. 11235 by Guillaume Lemaitre <glemaitre>`.
- |API| Deprecate `
n_valuesandcategorical_features` parameters and
`active_features_, feature_indices_ and n_values_ attributes of preprocessing.OneHotEncoder. The n_values parameter can be replaced with the new categories parameter, and the attributes with the new categories_ attribute. Selecting the categorical features with the categorical_features parameter is now better supported using the compose.ColumnTransformer. 10521 by Joris Van den Bossche`_.
- |API| Deprecate
preprocessing.Imputerand move
the corresponding module to impute.SimpleImputer. 9726 by :user:Kumar Ashutosh <thechargedneutron>.
- |API| The `
axis` parameter that was in
preprocessing.Imputer is no longer present in impute.SimpleImputer. The behavior is equivalent to `axis=0 (impute along columns). Row-wise imputation can be performed with FunctionTransformer (e.g., FunctionTransformer(lambda X: SimpleImputer().fit_transform(X.T).T)). 10829 by Guillaume Lemaitre <glemaitre> and Gilberto Olimpio <gilbertoolimpio>`.
- |API| The NaN marker for the missing values has been changed
between the preprocessing.Imputer and the impute.SimpleImputer. `missing_values='NaN' should now be missing_values=np.nan. 11211 by Jeremie du Boisberranger <jeremiedbb>`.
- |API| In
preprocessing.FunctionTransformer, the default of
`validate will be from True to False in 0.22. 10655 by Guillaume Lemaitre <glemaitre>`.
sklearn.svm ..................
- |Fix| Fixed a bug in
svm.SVCwhere when the argument `kernel` is
unicode in Python2, the `predict_proba method was raising an unexpected TypeError given dense inputs. 10412 by Jiongyan Zhang <qmick>`.
- |API| Deprecate `
random_stateparameter insvm.OneClassSVM` as
the underlying implementation is not random. 9497 by Albert Thomas <albertcthomas>.
- |API| The default value of `
gammaparameter ofsvm.SVC`,
~svm.NuSVC, ~svm.SVR, ~svm.NuSVR, ~svm.OneClassSVM will change from `'auto' to 'scale' in version 0.22 to account better for unscaled features. 8361 by Gaurav Dhingra <gxyd> and Ting Neo <neokt>`.
sklearn.tree ...................
- |Enhancement| Although private (and hence not assured API stability),
tree._criterion.ClassificationCriterion and tree._criterion.RegressionCriterion may now be cimported and extended. 10325 by Camil Staps <camilstaps>.
- |Fix| Fixed a bug in
tree.BaseDecisionTreewithsplitter="best"
where split threshold could become infinite when values in X were near infinite. 10536 by Jonathan Ohayon <Johayon>.
- |Fix| Fixed a bug in
tree.MAEto ensure sample weights are being
used during the calculation of tree MAE impurity. Previous behaviour could cause suboptimal splits to be chosen since the impurity calculation considered all samples to be of equal weight importance. 11464 by John Stott <JohnStott>.
sklearn.utils ....................
- |Feature|
utils.check_arrayandutils.check_X_ynow have
`accept_large_sparse to control whether scipy.sparse matrices with 64-bit indices should be rejected. 11327 by Karan Dhingra <kdhingra307> and Joel Nothman`_.
- |Efficiency| |Fix| Avoid copying the data in
utils.check_arraywhen
the input data is a memmap (and `copy=False). 10663 by Arthur Mensch <arthurmensch> and Loïc Estève <lesteve>`.
- |API|
utils.check_arrayyield a `FutureWarning` indicating
that arrays of bytes/strings will be interpreted as decimal numbers beginning in version 0.22. 10229 by Ryan Lee <rtlee9>
Multiple modules ................
- |Feature| |API| More consistent outlier detection API:
Add a `score_samples method in svm.OneClassSVM, ensemble.IsolationForest, neighbors.LocalOutlierFactor, covariance.EllipticEnvelope. It allows to access raw score functions from original papers. A new offset_ parameter allows to link score_samples and decision_function methods. The contamination parameter of ensemble.IsolationForest and neighbors.LocalOutlierFactor decision_function methods is used to define this offset_ such that outliers (resp. inliers) have negative (resp. positive) decision_function values. By default, contamination is kept unchanged to 0.1 for a deprecation period. In 0.22, it will be set to "auto", thus using method-specific score offsets. In covariance.EllipticEnvelope decision_function method, the raw_values parameter is deprecated as the shifted Mahalanobis distance will be always returned in 0.22. 9015 by Nicolas Goix`_.
- |Feature| |API| A `
behaviourparameter has been introduced inensemble.IsolationForest`
to ensure backward compatibility. In the old behaviour, the `decision_function is independent of the contamination parameter. A threshold attribute depending on the contamination parameter is thus used. In the new behaviour the decision_function is dependent on the contamination parameter, in such a way that 0 becomes its natural threshold to detect outliers. Setting behaviour to "old" is deprecated and will not be possible in version 0.22. Beside, the behaviour parameter will be removed in 0.24. 11553 by Nicolas Goix`_.
- |API| Added convergence warning to
svm.LinearSVCand
linear_model.LogisticRegression when `verbose is set to 0. 10881 by Alexandre Sevin <AlexandreSev>`.
- |API| Changed warning type from
UserWarningto
exceptions.ConvergenceWarning for failing convergence in linear_model.logistic_regression_path, linear_model.RANSACRegressor, linear_model.ridge_regression, gaussian_process.GaussianProcessRegressor, gaussian_process.GaussianProcessClassifier, decomposition.fastica, cross_decomposition.PLSCanonical, cluster.AffinityPropagation, and cluster.Birch. 10306 by Jonathan Siebert <jotasi>.
Miscellaneous .............
- |MajorFeature| A new configuration parameter, `
working_memory` was added
to control memory consumption limits in chunked operations, such as the new metrics.pairwise_distances_chunked. See working_memory. 10280 by Joel Nothman_ and Aman Dalmia <dalmia>.
- |Feature| The version of
joblibbundled with Scikit-learn is now 0.12.
This uses a new default multiprocessing implementation, named loky <https://github.com/tomMoral/loky>_. While this may incur some memory and communication overhead, it should provide greater cross-platform stability than relying on Python standard library multiprocessing. 11741 by the Joblib developers, especially Thomas Moreau <tomMoral> and Olivier Grisel_.
- |Feature| An environment variable to use the site joblib instead of the
vendored one was added (SKLEARN_SITE_JOBLIB). The main API of joblib is now exposed in sklearn.utils. 11166 by Gael Varoquaux_.
- |Feature| Add almost complete PyPy 3 support. Known unsupported
functionalities are datasets.load_svmlight_file, feature_extraction.FeatureHasher and feature_extraction.text.HashingVectorizer. For running on PyPy, PyPy3-v5.10+, Numpy 1.14.0+, and scipy 1.1.0+ are required. 11010 by Ronan Lamy <rlamy> and Roman Yurchak_.
- |Feature| A utility method
sklearn.show_versionswas added to
print out information relevant for debugging. It includes the user system, the Python executable, the version of the main libraries and BLAS binding information. 11596 by Alexandre Boucaud <aboucaud>
- |Fix| Fixed a bug when setting parameters on meta-estimator, involving both
a wrapped estimator and its parameter. 9999 by :user:Marcus Voss <marcus-voss> and Joel Nothman_.
- |Fix| Fixed a bug where calling
sklearn.base.clonewas not thread
safe and could result in a "pop from empty list" error. 9569 by Andreas Müller_.
- |API| The default value of `
n_jobsis changed from1toNone` in
all related functions and classes. `n_jobs=None means unset. It will generally be interpreted as n_jobs=1, unless the current joblib.Parallel backend context specifies otherwise (See Glossary <n_jobs> for additional information). Note that this change happens immediately (i.e., without a deprecation cycle). 11741 by Olivier Grisel`_.
- |Fix| Fixed a bug in validation helpers where passing a Dask DataFrame results
in an error. 12462 by Zachariah Miller <zwmiller>
Changes to estimator checks
These changes mostly affect library developers.
- Checks for transformers now apply if the estimator implements
transform, regardless of whether it inherits from sklearn.base.TransformerMixin. 10474 by Joel Nothman_.
- Classifiers are now checked for consistency between
decision_function
and categorical predictions. 10500 by Narine Kokhlikyan <NarineK>.
- Allow tests in
utils.estimator_checks.check_estimatorto test functions
that accept pairwise data. 9701 by Kyle Johnson <gkjohns>
- Allow
utils.estimator_checks.check_estimatorto check that there is no
private settings apart from parameters during estimator initialization. 9378 by Herilalaina Rakotoarison <herilalaina>
- The set of checks in
utils.estimator_checks.check_estimatornow includes a
`check_set_params test which checks that set_params is equivalent to passing parameters in __init__ and warns if it encounters parameter validation. 7738 by Alvin Chiang <absolutelyNoWarranty>`
- Add invariance tests for clustering metrics.
8102by :user:`Ankita
Sinha <anki08> and Guillaume Lemaitre <glemaitre>`.
- Add `
check_methods_subset_invariance` to
~utils.estimator_checks.check_estimator, which checks that estimator methods are invariant if applied to a data subset. 10428 by Jonathan Ohayon <Johayon>
- Add tests in
utils.estimator_checks.check_estimatorto check that an
estimator can handle read-only memmap input data. 10663 by Arthur Mensch <arthurmensch> and Loïc Estève <lesteve>.
- `
check_sample_weights_pandas_series` now uses 8 rather than 6 samples
to accommodate for the default number of clusters in cluster.KMeans. 10933 by Johannes Hansen <jnhansen>.
- Estimators are now checked for whether `
sample_weight=None` equates to
`sample_weight=np.ones(...). 11558 by Sergul Aydore <sergulaydore>`.
Code and Documentation Contributors
Thanks to everyone who has contributed to the maintenance and improvement of the project since version 0.19, including:
211217613, Aarshay Jain, absolutelyNoWarranty, Adam Greenhall, Adam Kleczewski, Adam Richie-Halford, adelr, AdityaDaflapurkar, Adrin Jalali, Aidan Fitzgerald, aishgrt1, Akash Shivram, Alan Liddell, Alan Yee, Albert Thomas, Alexander Lenail, Alexander-N, Alexandre Boucaud, Alexandre Gramfort, Alexandre Sevin, Alex Egg, Alvaro Perez-Diaz, Amanda, Aman Dalmia, Andreas Bjerre-Nielsen, Andreas Mueller, Andrew Peng, Angus Williams, Aniruddha Dave, annaayzenshtat, Anthony Gitter, Antonio Quinonez, Anubhav Marwaha, Arik Pamnani, Arthur Ozga, Artiem K, Arunava, Arya McCarthy, Attractadore, Aurélien Bellet, Aurélien Geron, Ayush Gupta, Balakumaran Manoharan, Bangda Sun, Barry Hart, Bastian Venthur, Ben Lawson, Benn Roth, Breno Freitas, Brent Yi, brett koonce, Caio Oliveira, Camil Staps, cclauss, Chady Kamar, Charlie Brummitt, Charlie Newey, chris, Chris, Chris Catalfo, Chris Foster, Chris Holdgraf, Christian Braune, Christian Hirsch, Christian Hogan, Christopher Jenness, Clement Joudet, cnx, cwitte, Dallas Card, Dan Barkhorn, Daniel, Daniel Ferreira, Daniel Gomez, Daniel Klevebring, Danielle Shwed, Daniel Mohns, Danil Baibak, Darius Morawiec, David Beach, David Burns, David Kirkby, David Nicholson, David Pickup, Derek, Didi Bar-Zev, diegodlh, Dillon Gardner, Dillon Niederhut, dilutedsauce, dlovell, Dmitry Mottl, Dmitry Petrov, Dor Cohen, Douglas Duhaime, Ekaterina Tuzova, Eric Chang, Eric Dean Sanchez, Erich Schubert, Eunji, Fang-Chieh Chou, FarahSaeed, felix, Félix Raimundo, fenx, filipj8, FrankHui, Franz Wompner, Freija Descamps, frsi, Gabriele Calvo, Gael Varoquaux, Gaurav Dhingra, Georgi Peev, Gil Forsyth, Giovanni Giuseppe Costa, gkevinyen5418, goncalo-rodrigues, Gryllos Prokopis, Guillaume Lemaitre, Guillaume "Vermeille" Sanchez, Gustavo De Mari Pereira, hakaa1, Hanmin Qin, Henry Lin, Hong, Honghe, Hossein Pourbozorg, Hristo, Hunan Rostomyan, iampat, Ivan PANICO, Jaewon Chung, Jake VanderPlas, jakirkham, James Bourbeau, James Malcolm, Jamie Cox, Jan Koch, Jan Margeta, Jan Schlüter, janvanrijn, Jason Wolosonovich, JC Liu, Jeb Bearer, jeremiedbb, Jimmy Wan, Jinkun Wang, Jiongyan Zhang, jjabl, jkleint, Joan Massich, Joël Billaud, Joel Nothman, Johannes Hansen, JohnStott, Jonatan Samoocha, Jonathan Ohayon, Jörg Döpfert, Joris Van den Bossche, Jose Perez-Parras Toledano, josephsalmon, jotasi, jschendel, Julian Kuhlmann, Julien Chaumond, julietcl, Justin Shenk, Karl F, Kasper Primdal Lauritzen, Katrin Leinweber, Kirill, ksemb, Kuai Yu, Kumar Ashutosh, Kyeongpil Kang, Kye Taylor, kyledrogo, Leland McInnes, Léo DS, Liam Geron, Liutong Zhou, Lizao Li, lkjcalc, Loic Esteve, louib, Luciano Viola, Lucija Gregov, Luis Osa, Luis Pedro Coelho, Luke M Craig, Luke Persola, Mabel, Mabel Villalba, Maniteja Nandana, MarkIwanchyshyn, Mark Roth, Markus Müller, MarsGuy, Martin Gubri, martin-hahn, martin-kokos, mathurinm, Matthias Feurer, Max Copeland, Mayur Kulkarni, Meghann Agarwal, Melanie Goetz, Michael A. Alcorn, Minghui Liu, Ming Li, Minh Le, Mohamed Ali Jamaoui, Mohamed Maskani, Mohammad Shahebaz, Muayyad Alsadi, Nabarun Pal, Nagarjuna Kumar, Naoya Kanai, Narendran Santhanam, NarineK, Nathaniel Saul, Nathan Suh, Nicholas Nadeau, P.Eng., AVS, Nick Hoh, Nicolas Goix, Nicolas Hug, Nicolau Werneck, nielsenmarkus11, Nihar Sheth, Nikita Titov, Nilesh Kevlani, Nirvan Anjirbag, notmatthancock, nzw, Oleksandr Pavlyk, oliblum90, Oliver Rausch, Olivier Grisel, Oren Milman, Osaid Rehman Nasir, pasbi, Patrick Fernandes, Patrick Olden, Paul Paczuski, Pedro Morales, Peter, Peter St. John, pierreablin, pietruh, Pinaki Nath Chowdhury, Piotr Szymański, Pradeep Reddy Raamana, Pravar D Mahajan, pravarmahajan, QingYing Chen, Raghav RV, Rajendra arora, RAKOTOARISON Herilalaina, Rameshwar Bhaskaran, RankyLau, Rasul Kerimov, Reiichiro Nakano, Rob, Roman Kosobrodov, Roman Yurchak, Ronan Lamy, rragundez, Rüdiger Busche, Ryan, Sachin Kelkar, Sagnik Bhattacharya, Sailesh Choyal, Sam Radhakrishnan, Sam Steingold, Samuel Bell, Samuel O. Ronsin, Saqib Nizam Shamsi, SATISH J, Saurabh Gupta, Scott Gigante, Sebastian Flennerhag, Sebastian Raschka, Sebastien Dubois, Sébastien Lerique, Sebastin Santy, Sergey Feldman, Sergey Melderis, Sergul Aydore, Shahebaz, Shalil Awaley, Shangwu Yao, Sharad Vijalapuram, Sharan Yalburgi, shenhanc78, Shivam Rastogi, Shu Haoran, siftikha, Sinclert Pérez, SolutusImmensus, Somya Anand, srajan paliwal, Sriharsha Hatwar, Sri Krishna, Stefan van der Walt, Stephen McDowell, Steven Brown, syonekura, Taehoon Lee, Takanori Hayashi, tarcusx, Taylor G Smith, theriley106, Thomas, Thomas Fan, Thomas Heavey, Tobias Madsen, tobycheese, Tom Augspurger, Tom Dupré la Tour, Tommy, Trevor Stephens, Trishnendu Ghorai, Tulio Casagrande, twosigmajab, Umar Farouk Umar, Urvang Patel, Utkarsh Upadhyay, Vadim Markovtsev, Varun Agrawal, Vathsala Achar, Vilhelm von Ehrenheim, Vinayak Mehta, Vinit, Vinod Kumar L, Viraj Mavani, Viraj Navkal, Vivek Kumar, Vlad Niculae, vqean3, Vrishank Bhardwaj, vufg, wallygauze, Warut Vijitbenjaronk, wdevazelhes, Wenhao Zhang, Wes Barnett, Will, William de Vazelhes, Will Rosenfeld, Xin Xiong, Yiming (Paul) Li, ymazari, Yufeng, Zach Griffith, Zé Vinícius, Zhenqing Hu, Zhiqing Xiao, Zijie (ZJ) Poh