Version 0.19
scikit-learn Docs · نسخهٔ 5e9184e53cd3 · BSD-3-Clause
============
Version 0.19
Version 0.19.2
July, 2018
This release is exclusively in order to support Python 3.7.
Related changes
- `
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`_.
Version 0.19.1
October 23, 2017
This is a bug-fix release with some minor documentation improvements and enhancements to features released in 0.19.0.
Note there may be minor differences in TSNE output in this release (due to 9623), in the case where multiple samples have equal distance to some sample.
Changelog
API changes ...........
- Reverted the addition of `
metrics.ndcg_scoreandmetrics.dcg_score`
which had been merged into version 0.19.0 by error. The implementations were broken and undocumented.
- `
return_train_score` which was added to
model_selection.GridSearchCV, model_selection.RandomizedSearchCV and model_selection.cross_validate in version 0.19.0 will be changing its default value from True to False in version 0.21. We found that calculating training score could have a great effect on cross validation runtime in some cases. Users should explicitly set `return_train_score to False if prediction or scoring functions are slow, resulting in a deleterious effect on CV runtime, or to True if they wish to use the calculated scores. 9677 by Kumar Ashutosh <thechargedneutron> and Joel Nothman`_.
- `
correlation_modelsandregression_models` from the legacy gaussian
processes implementation have been belatedly deprecated. 9717 by Kumar Ashutosh <thechargedneutron>.
Bug fixes .........
- Avoid integer overflows in
metrics.matthews_corrcoef.
9693 by Sam Steingold <sam-s>.
- Fixed a bug in the objective function for
manifold.TSNE(both exact
and with the Barnes-Hut approximation) when `n_components >= 3. 9711 by goncalo-rodrigues`.
- Fix regression in
model_selection.cross_val_predictwhere it
raised an error with `method='predict_proba' for some probabilistic classifiers. 9641 by James Bourbeau <jrbourbeau>`.
- Fixed a bug where
datasets.make_classificationmodified its input
`weights. 9865 by Sachin Kelkar <s4chin>`.
model_selection.StratifiedShuffleSplitnow works with multioutput
multiclass or multilabel data with more than 1000 columns. 9922 by Charlie Brummitt <crbrummitt>.
- Fixed a bug with nested and conditional parameter setting, e.g. setting a
pipeline step and its parameter at the same time. 9945 by Andreas Müller_ and Joel Nothman_.
Regressions in 0.19.0 fixed in 0.19.1:
- Fixed a bug where parallelised prediction in random forests was not
thread-safe and could (rarely) result in arbitrary errors. 9830 by Joel Nothman_.
- Fix regression in
model_selection.cross_val_predictwhere it no
longer accepted `X as a list. 9600 by :user:Rasul Kerimov <CoderINusE>`.
- Fixed handling of
model_selection.cross_val_predictfor binary
classification with `method='decision_function'. 9593 by Reiichiro Nakano <reiinakano>` and core devs.
- Fix regression in
pipeline.Pipelinewhere it no longer accepted
`steps as a tuple. 9604 by :user:Joris Van den Bossche <jorisvandenbossche>`.
- Fix bug where `
n_iterwas not properly deprecated, leavingn_iter`
unavailable for interim use in linear_model.SGDClassifier, linear_model.SGDRegressor, linear_model.PassiveAggressiveClassifier, linear_model.PassiveAggressiveRegressor and linear_model.Perceptron. 9558 by Andreas Müller_.
- Dataset fetchers make sure temporary files are closed before removing them,
which caused errors on Windows. 9847 by Joan Massich <massich>.
- Fixed a regression in
manifold.TSNEwhere it no longer supported
metrics other than 'euclidean' and 'precomputed'. 9623 by :user:Oli Blum <oliblum90>.
Enhancements ............
- Our test suite and
utils.estimator_checks.check_estimatorcan now be
run without Nose installed. 9697 by Joan Massich <massich>.
- To improve usability of version 0.19's
pipeline.Pipeline
caching, `memory now allows joblib.Memory instances. This make use of the new utils.validation.check_memory helper. 9584 by Kumar Ashutosh <thechargedneutron>`
- Some fixes to examples:
9750,9788,9815
- Made a FutureWarning in SGD-based estimators less verbose.
9802by
Vrishank Bhardwaj <vrishank97>.
Code and Documentation Contributors
With thanks to:
Joel Nothman, Loic Esteve, Andreas Mueller, Kumar Ashutosh, Vrishank Bhardwaj, Hanmin Qin, Rasul Kerimov, James Bourbeau, Nagarjuna Kumar, Nathaniel Saul, Olivier Grisel, Roman Yurchak, Reiichiro Nakano, Sachin Kelkar, Sam Steingold, Yaroslav Halchenko, diegodlh, felix, goncalo-rodrigues, jkleint, oliblum90, pasbi, Anthony Gitter, Ben Lawson, Charlie Brummitt, Didi Bar-Zev, Gael Varoquaux, Joan Massich, Joris Van den Bossche, nielsenmarkus11
Version 0.19
August 12, 2017
Highlights
We are excited to release a number of great new features including neighbors.LocalOutlierFactor for anomaly detection, preprocessing.QuantileTransformer for robust feature transformation, and the multioutput.ClassifierChain meta-estimator to simply account for dependencies between classes in multilabel problems. We have some new algorithms in existing estimators, such as multiplicative update in decomposition.NMF and multinomial linear_model.LogisticRegression with L1 loss (use `solver='saga'`).
Cross validation is now able to return the results from multiple metric evaluations. The new model_selection.cross_validate can return many scores on the test data as well as training set performance and timings, and we have extended the `scoring and refit parameters for grid/randomized search to handle multiple metrics <multimetric_grid_search>`.
You can also learn faster. For instance, the :ref:new option to cache transformations <pipeline_cache> in pipeline.Pipeline makes grid search over pipelines including slow transformations much more efficient. And you can predict faster: if you're sure you know what you're doing, you can turn off validating that the input is finite using config_context.
We've made some important fixes too. We've fixed a longstanding implementation error in metrics.average_precision_score, so please be cautious with prior results reported from that function. A number of errors in the manifold.TSNE implementation have been fixed, particularly in the default Barnes-Hut approximation. semi_supervised.LabelSpreading and semi_supervised.LabelPropagation have had substantial fixes. LabelPropagation was previously broken. LabelSpreading should now correctly respect its alpha parameter.
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.KMeanswith sparse X and initial centroids given (bug fix)cross_decomposition.PLSRegression
with `scale=True` (bug fix)
ensemble.GradientBoostingClassifierand
ensemble.GradientBoostingRegressor where `min_impurity_split` is used (bug fix)
- gradient boosting `
loss='quantile'` (bug fix) ensemble.IsolationForest(bug fix)feature_selection.SelectFdr(bug fix)linear_model.RANSACRegressor(bug fix)linear_model.LassoLars(bug fix)linear_model.LassoLarsIC(bug fix)manifold.TSNE(bug fix)neighbors.NearestCentroid(bug fix)semi_supervised.LabelSpreading(bug fix)semi_supervised.LabelPropagation(bug fix)- tree based models where `
min_weight_fraction_leaf` is used (enhancement) model_selection.StratifiedKFoldwith `shuffle=True`
(this change, due to 7823 was not mentioned in the release notes at the time)
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.)
Changelog
New features ............
Classifiers and regressors
- Added
multioutput.ClassifierChainfor multi-label
classification. By Adam Kleczewski <adamklec>.
- Added solver `
'saga'` that implements the improved version of Stochastic
Average Gradient, in linear_model.LogisticRegression and linear_model.Ridge. It allows the use of L1 penalty with multinomial logistic loss, and behaves marginally better than 'sag' during the first epochs of ridge and logistic regression. 8446 by Arthur Mensch_.
Other estimators
- Added the
neighbors.LocalOutlierFactorclass for anomaly
detection based on nearest neighbors. 5279 by Nicolas Goix_ and Alexandre Gramfort_.
- Added
preprocessing.QuantileTransformerclass and
preprocessing.quantile_transform function for features normalization based on quantiles. 8363 by Denis Engemann <dengemann>, Guillaume Lemaitre <glemaitre>, Olivier Grisel_, Raghav RV_, Thierry Guillemot <tguillemot>, and Gael Varoquaux_.
- The new solver `
'mu'` implements a Multiplicate Update in
decomposition.NMF, allowing the optimization of all beta-divergences, including the Frobenius norm, the generalized Kullback-Leibler divergence and the Itakura-Saito divergence. 5295 by Tom Dupre la Tour_.
Model selection and evaluation
model_selection.GridSearchCVand
model_selection.RandomizedSearchCV now support simultaneous evaluation of multiple metrics. Refer to the multimetric_grid_search section of the user guide for more information. 7388 by Raghav RV_
- Added the
model_selection.cross_validatewhich allows evaluation
of multiple metrics. This function returns a dict with more useful information from cross-validation such as the train scores, fit times and score times. Refer to multimetric_cross_validation section of the userguide for more information. 7388 by Raghav RV_
- Added
metrics.mean_squared_log_error, which computes
the mean square error of the logarithmic transformation of targets, particularly useful for targets with an exponential trend. 7655 by Karan Desai <karandesai-96>.
- Added
metrics.dcg_scoreandmetrics.ndcg_score, which
compute Discounted cumulative gain (DCG) and Normalized discounted cumulative gain (NDCG). 7739 by David Gasquez <davidgasquez>.
- Added the
model_selection.RepeatedKFoldand
model_selection.RepeatedStratifiedKFold. 8120 by Neeraj Gangwar_.
Miscellaneous
- Validation that input data contains no NaN or inf can now be suppressed
using config_context, at your own risk. This will save on runtime, and may be particularly useful for prediction time. 7548 by Joel Nothman_.
- Added a test to ensure parameter listing in docstrings matches the
function/class signature. 9206 by Alexandre Gramfort_ and Raghav RV_.
Enhancements ............
Trees and ensembles
- The `
min_weight_fraction_leaf` constraint in tree construction is now
more efficient, taking a fast path to declare a node a leaf if its weight is less than 2 * the minimum. Note that the constructed tree will be different from previous versions where `min_weight_fraction_leaf is used. 7441 by Nelson Liu <nelson-liu>`.
ensemble.GradientBoostingClassifierandensemble.GradientBoostingRegressor
now support sparse input for prediction. 6101 by Ibraim Ganiev <olologin>.
ensemble.VotingClassifiernow allows changing estimators by using
ensemble.VotingClassifier.set_params. An estimator can also be removed by setting it to `None. 7674 by Yichuan Liu <yl565>`.
tree.export_graphviznow shows configurable number of decimal
places. 8698 by Guillaume Lemaitre <glemaitre>.
- Added `
flatten_transformparameter toensemble.VotingClassifier`
to change output shape of transform method to 2 dimensional. 7794 by Ibraim Ganiev <olologin> and Herilalaina Rakotoarison <herilalaina>.
Linear, kernelized and related models
linear_model.SGDClassifier,linear_model.SGDRegressor,
linear_model.PassiveAggressiveClassifier, linear_model.PassiveAggressiveRegressor and linear_model.Perceptron now expose `max_iter and tol parameters, to handle convergence more precisely. n_iter parameter is deprecated, and the fitted estimator exposes a n_iter_ attribute, with actual number of iterations before convergence. 5036 by Tom Dupre la Tour`_.
- Added `
average` parameter to perform weight averaging in
linear_model.PassiveAggressiveClassifier. 4939 by Andrea Esuli <aesuli>.
linear_model.RANSACRegressorno longer throws an error
when calling `fit if no inliers are found in its first iteration. Furthermore, causes of skipped iterations are tracked in newly added attributes, n_skips_*. 7914 by Michael Horrell <mthorrell>`.
- In
gaussian_process.GaussianProcessRegressor, method `predict`
is a lot faster with `return_std=True. 8591 by Hadrien Bertrand <hbertrand>`.
- Added `
return_stdtopredict` method of
linear_model.ARDRegression and linear_model.BayesianRidge. 7838 by Sergey Feldman <sergeyf>.
- Memory usage enhancements: Prevent cast from float32 to float64 in:
linear_model.MultiTaskElasticNet; linear_model.LogisticRegression when using newton-cg solver; and linear_model.Ridge when using svd, sparse_cg, cholesky or lsqr solvers. 8835, 8061 by Joan Massich <massich> and :user:Nicolas Cordier <ncordier> and Thierry Guillemot <tguillemot>.
Other predictors
- Custom metrics for the
sklearn.neighborsbinary trees now have
fewer constraints: they must take two 1d-arrays and return a float. 6288 by Jake Vanderplas_.
- `
algorithm='autoinsklearn.neighbors` estimators now chooses the most
appropriate algorithm for all input types and metrics. 9145 by Herilalaina Rakotoarison <herilalaina> and :user:Reddy Chinthala <preddy5>.
Decomposition, manifold learning and clustering
cluster.MiniBatchKMeansandcluster.KMeans
now use significantly less memory when assigning data points to their nearest cluster center. 7721 by Jon Crall <Erotemic>.
decomposition.PCA,decomposition.IncrementalPCAand
decomposition.TruncatedSVD now expose the singular values from the underlying SVD. They are stored in the attribute `singular_values_, like in decomposition.IncrementalPCA. 7685 by Tommy Löfstedt <tomlof>`
decomposition.NMFnow faster when `beta_loss=0`.
9277 by hongkahjun.
- Memory improvements for method `
barnes_hutinmanifold.TSNE`
7089 by Thomas Moreau <tomMoral> and Olivier Grisel_.
- Optimization schedule improvements for Barnes-Hut
manifold.TSNE
so the results are closer to the one from the reference implementation lvdmaaten/bhtsne <https://github.com/lvdmaaten/bhtsne>_ by :user:Thomas Moreau <tomMoral> and Olivier Grisel_.
- Memory usage enhancements: Prevent cast from float32 to float64 in
decomposition.PCA and decomposition.randomized_svd_low_rank. 9067 by Raghav RV_.
Preprocessing and feature selection
- Added `
norm_orderparameter tofeature_selection.SelectFromModel`
to enable selection of the norm order when `coef_ is more than 1D. 6181 by Antoine Wendlinger <antoinewdg>`.
- Added ability to use sparse matrices in
feature_selection.f_regression
with `center=True. 8065 by Daniel LeJeune <acadiansith>`.
- Small performance improvement to n-gram creation in
sklearn.feature_extraction.text by binding methods for loops and special-casing unigrams. 7567 by Jaye Doepke <jtdoepke>
- Relax assumption on the data for the
kernel_approximation.SkewedChi2Sampler. Since the Skewed-Chi2 kernel is defined on the open interval (-skewedness; +\infty)^d, the transform function should not check whether `X < 0 but whether X < -self.skewedness. 7573 by Romain Brault <RomainBrault>`.
- Made default kernel parameters kernel-dependent in
kernel_approximation.Nystroem. 5229 by Saurabh Bansod <mth4saurabh> and Andreas Müller_.
Model evaluation and meta-estimators
pipeline.Pipelineis now able to cache transformers
within a pipeline by using the `memory constructor parameter. 7990 by Guillaume Lemaitre <glemaitre>`.
pipeline.Pipelinesteps can now be accessed as attributes of its
`named_steps attribute. 8586 by :user:Herilalaina Rakotoarison <herilalaina>`.
- Added `
sample_weightparameter topipeline.Pipeline.score`.
7723 by Mikhail Korobov <kmike>.
- Added ability to set `
n_jobsparameter topipeline.make_union`.
A `TypeError will be raised for any other kwargs. 8028 by Alexander Booth <alexandercbooth>`.
model_selection.GridSearchCV,
model_selection.RandomizedSearchCV and model_selection.cross_val_score now allow estimators with callable kernels which were previously prohibited. 8005 by Andreas Müller_ .
model_selection.cross_val_predictnow returns output of the
correct shape for all values of the argument `method. 7863 by Aman Dalmia <dalmia>`.
- Added `
shuffleandrandom_state` parameters to shuffle training
data before taking prefixes of it based on training sizes in model_selection.learning_curve. 7506 by Narine Kokhlikyan <NarineK>.
model_selection.StratifiedShuffleSplitnow works with multioutput
multiclass (or multilabel) data. 9044 by Vlad Niculae_.
- Speed improvements to
model_selection.StratifiedShuffleSplit.
5991 by Arthur Mensch <arthurmensch> and Joel Nothman_.
- Add `
shuffleparameter tomodel_selection.train_test_split`.
8845 by themrmax <themrmax>
multioutput.MultiOutputRegressorandmultioutput.MultiOutputClassifier
now support online learning using `partial_fit. :issue: 8053 by Peng Yu <yupbank>`.
- Add `
max_train_sizeparameter tomodel_selection.TimeSeriesSplit`
8282 by Aman Dalmia <dalmia>.
- More clustering metrics are now available through
metrics.get_scorer
and `scoring parameters. 8117 by Raghav RV`_.
- A scorer based on
metrics.explained_variance_scoreis also available.
9259 by Hanmin Qin <qinhanmin2014>.
Metrics
metrics.matthews_corrcoefnow supports multiclass classification.
8094 by Jon Crall <Erotemic>.
- Add `
sample_weightparameter tometrics.cohen_kappa_score`.
8335 by Victor Poughon <vpoughon>.
Miscellaneous
utils.estimator_checks.check_estimatornow attempts to ensure that methods
transform, predict, etc. do not set attributes on the estimator. 7533 by Ekaterina Krivich <kiote>.
- Added type checking to the `
accept_sparse` parameter in
sklearn.utils.validation methods. This parameter now accepts only boolean, string, or list/tuple of strings. `accept_sparse=None is deprecated and should be replaced by accept_sparse=False. 7880 by Josh Karnofsky <jkarno>`.
- Make it possible to load a chunk of an svmlight formatted file by
passing a range of bytes to datasets.load_svmlight_file. 935 by Olivier Grisel <ogrisel>.
dummy.DummyClassifieranddummy.DummyRegressor
now accept non-finite features. 8931 by Attractadore.
Bug fixes .........
Trees and ensembles
- Fixed a memory leak in trees when using trees with `
criterion='mae'`.
8002 by Raghav RV_.
- Fixed a bug where
ensemble.IsolationForestuses an
incorrect formula for the average path length 8549 by Peter Wang <https://github.com/PTRWang>_.
- Fixed a bug where
ensemble.AdaBoostClassifierthrows
`ZeroDivisionError while fitting data with single class labels. 7501 by Dominik Krzeminski <dokato>`.
- Fixed a bug in
ensemble.GradientBoostingClassifierand
ensemble.GradientBoostingRegressor where a float being compared to `0.0 using == caused a divide by zero error. 7970 by He Chen <chenhe95>`.
- Fix a bug where
ensemble.GradientBoostingClassifierand
ensemble.GradientBoostingRegressor ignored the `min_impurity_split parameter. 8006 by Sebastian Pölsterl <sebp>`.
- Fixed `
oob_scoreinensemble.BaggingClassifier`.
8936 by Michael Lewis <mlewis1729>
- Fixed excessive memory usage in prediction for random forests estimators.
8672 by Mike Benfield <mikebenfield>.
- Fixed a bug where `
sample_weight` as a list broke random forests in Python 2
8068 by xor.
- Fixed a bug where
ensemble.IsolationForestfails when
`max_features is less than 1. 5732 by Ishank Gulati <IshankGulati>`.
- Fix a bug where gradient boosting with `
loss='quantile'` computed
negative errors for negative values of `ytrue - ypred leading to wrong values when calling __call__. 8087 by Alexis Mignon <AlexisMignon>`
- Fix a bug where
ensemble.VotingClassifierraises an error
when a numpy array is passed in for weights. 7983 by Vincent Pham <vincentpham1991>.
- Fixed a bug where
tree.export_graphvizraised an error
when the length of features_names does not match n_features in the decision tree. 8512 by Li Li <aikinogard>.
Linear, kernelized and related models
- Fixed a bug where
linear_model.RANSACRegressor.fitmay run until
`max_iter if it finds a large inlier group early. 8251 by aivision2020`.
- Fixed a bug where
naive_bayes.MultinomialNBand
naive_bayes.BernoulliNB failed when `alpha=0. 5814 by Yichuan Liu <yl565> and :user:Herilalaina Rakotoarison <herilalaina>`.
- Fixed a bug where
linear_model.LassoLarsdoes not give
the same result as the LassoLars implementation available in R (lars library). 7849 by Jair Montoya Martinez <jmontoyam>.
- Fixed a bug in
linear_model.RandomizedLasso,
linear_model.Lars, linear_model.LassoLars, linear_model.LarsCV and linear_model.LassoLarsCV, where the parameter `precompute was not used consistently across classes, and some values proposed in the docstring could raise errors. 5359 by Tom Dupre la Tour`_.
- Fix inconsistent results between
linear_model.RidgeCVand
linear_model.Ridge when using `normalize=True. 9302 by Alexandre Gramfort`_.
- Fix a bug where
linear_model.LassoLars.fitsometimes
left `coef_ as a list, rather than an ndarray. 8160 by CJ Carey <perimosocordiae>`.
- Fix
linear_model.BayesianRidge.fitto return
ridge parameter `alpha_ and lambda_ consistent with calculated coefficients coef_ and intercept_. 8224 by Peter Gedeck <gedeck>`.
- Fixed a bug in
svm.OneClassSVMwhere it returned floats instead of
integer classes. 8676 by Vathsala Achar <VathsalaAchar>.
- Fix AIC/BIC criterion computation in
linear_model.LassoLarsIC.
9022 by Alexandre Gramfort_ and Mehmet Basbug <mehmetbasbug>.
- Fixed a memory leak in our LibLinear implementation.
9024by
Sergei Lebedev <superbobry>
- Fix bug where stratified CV splitters did not work with
linear_model.LassoCV. 8973 by Paulo Haddad <paulochf>.
- Fixed a bug in
gaussian_process.GaussianProcessRegressor
when the standard deviation and covariance predicted without fit would fail with a meaningless error by default. 6573 by Quazi Marufur Rahman <qmaruf> and Manoj Kumar_.
Other predictors
- Fix
semi_supervised.BaseLabelPropagationto correctly implement
`LabelPropagation and LabelSpreading as done in the referenced papers. 9239 by Andre Ambrosio Boechat <boechat107>, :user:Utkarsh Upadhyay <musically-ut>, and Joel Nothman`_.
Decomposition, manifold learning and clustering
- Fixed the implementation of
manifold.TSNE: - `
early_exaggeration` parameter had no effect and is now used for the
first 250 optimization iterations.
- Fixed the `
AssertionError: Tree consistency failed` exception
reported in 8992.
- Improve the learning schedule to match the one from the reference
implementation lvdmaaten/bhtsne <https://github.com/lvdmaaten/bhtsne>_. by Thomas Moreau <tomMoral> and Olivier Grisel_.
- Fix a bug in
decomposition.LatentDirichletAllocation
where the `perplexity method was returning incorrect results because the transform method returns normalized document topic distributions as of version 0.18. 7954 by Gary Foreman <garyForeman>`.
- Fix output shape and bugs with n_jobs > 1 in
decomposition.SparseCoder transform and decomposition.sparse_encode for one-dimensional data and one component. This also impacts the output shape of decomposition.DictionaryLearning. 8086 by Andreas Müller_.
- Fixed the implementation of `
explained_variance_`
in decomposition.PCA, decomposition.RandomizedPCA and decomposition.IncrementalPCA. 9105 by Hanmin Qin <https://github.com/qinhanmin2014>_.
- Fixed the implementation of `
noise_variance_indecomposition.PCA`.
9108 by Hanmin Qin <https://github.com/qinhanmin2014>_.
- Fixed a bug where
cluster.DBSCANgives incorrect
result when input is a precomputed sparse matrix with initial rows all zero. 8306 by Akshay Gupta <Akshay0724>
- Fix a bug regarding fitting
cluster.KMeanswith a sparse
array X and initial centroids, where X's means were unnecessarily being subtracted from the centroids. 7872 by Josh Karnofsky <jkarno>.
- Fixes to the input validation in
covariance.EllipticEnvelope.
8086 by Andreas Müller_.
- Fixed a bug in
covariance.MinCovDetwhere inputting data
that produced a singular covariance matrix would cause the helper method `_c_step to throw an exception. 3367 by Jeremy Steward <ThatGeoGuy>`
- Fixed a bug in
manifold.TSNEaffecting convergence of the
gradient descent. 8768 by David DeTomaso <deto>.
- Fixed a bug in
manifold.TSNEwhere it stored the incorrect
`kl_divergence_. 6507 by Sebastian Saeger <ssaeger>`.
- Fixed improper scaling in
cross_decomposition.PLSRegression
with `scale=True. 7819 by jayzed82 <jayzed82>`.
cluster.SpectralCoclusteringand
cluster.SpectralBiclustering `fit method conforms with API by accepting y and returning the object. 6126, 7814 by Laurent Direr <ldirer> and :user:Maniteja Nandana <maniteja123>`.
- Fix bug where
sklearn.mixture`sample` methods did not return as many
samples as requested. 7702 by Levi John Wolf <ljwolf>.
- Fixed the shrinkage implementation in
neighbors.NearestCentroid.
9219 by Hanmin Qin <https://github.com/qinhanmin2014>_.
Preprocessing and feature selection
- For sparse matrices,
preprocessing.normalizewith `return_norm=True`
will now raise a `NotImplementedError with 'l1' or 'l2' norm and with norm 'max' the norms returned will be the same as for dense matrices. 7771 by Ang Lu <https://github.com/luang008>`_.
- Fix a bug where
feature_selection.SelectFdrdid not
exactly implement Benjamini-Hochberg procedure. It formerly may have selected fewer features than it should. 7490 by Peng Meng <mpjlu>.
- Fixed a bug where
linear_model.RandomizedLassoand
linear_model.RandomizedLogisticRegression break for sparse input. 8259 by Aman Dalmia <dalmia>.
- Fix a bug where
feature_extraction.FeatureHasher
mandatorily applied a sparse random projection to the hashed features, preventing the use of feature_extraction.text.HashingVectorizer in a pipeline with feature_extraction.text.TfidfTransformer. 7565 by Roman Yurchak <rth>.
- Fix a bug where
feature_selection.mutual_info_regressiondid not
correctly use `n_neighbors. 8181 by :user:Guillaume Lemaitre <glemaitre>`.
Model evaluation and meta-estimators
- Fixed a bug where
model_selection.BaseSearchCV.inverse_transform
returns `self.best_estimator_.transform() instead of self.best_estimator_.inverse_transform(). 8344 by Akshay Gupta <Akshay0724> and Rasmus Eriksson <MrMjauh>`.
- Added `
classes_attribute tomodel_selection.GridSearchCV`,
model_selection.RandomizedSearchCV, grid_search.GridSearchCV, and grid_search.RandomizedSearchCV that matches the `classes_ attribute of best_estimator_. 7661 and 8295 by Alyssa Batula <abatula>, Dylan Werner-Meier <unautre>, and Stephen Hoover <stephen-hoover>`.
- Fixed a bug where
model_selection.validation_curve
reused the same estimator for each parameter value. 7365 by Aleksandr Sandrovskii <Sundrique>.
model_selection.permutation_test_scorenow works with Pandas
types. 5697 by Stijn Tonk <equialgo>.
- Several fixes to input validation in
multiclass.OutputCodeClassifier 8086 by Andreas Müller_.
multiclass.OneVsOneClassifier's `partial_fit` now ensures all
classes are provided up-front. 6250 by Asish Panda <kaichogami>.
- Fix
multioutput.MultiOutputClassifier.predict_probato return a
list of 2d arrays, rather than a 3d array. In the case where different target columns had different numbers of classes, a `ValueError would be raised on trying to stack matrices with different dimensions. 8093 by Peter Bull <pjbull>`.
- Cross validation now works with Pandas datatypes that have a
read-only index. 9507 by Loic Esteve_.
Metrics
metrics.average_precision_scoreno longer linearly
interpolates between operating points, and instead weighs precisions by the change in recall since the last operating point, as per the Wikipedia entry <https://en.wikipedia.org/wiki/Average_precision>_. (#7356 <https://github.com/scikit-learn/scikit-learn/pull/7356>_). By Nick Dingwall <ndingwall> and Gael Varoquaux_.
- Fix a bug in
metrics.classification._check_targets
which would return `'binary' if y_true and y_pred were both 'binary' but the union of y_true and y_pred was 'multiclass'. 8377 by Loic Esteve`_.
- Fixed an integer overflow bug in
metrics.confusion_matrixand
hence metrics.cohen_kappa_score. 8354, 7929 by Joel Nothman_ and Jon Crall <Erotemic>.
- Fixed passing of `
gammaparameter to thechi2` kernel in
metrics.pairwise.pairwise_kernels 5211 by Nick Rhinehart <nrhine1>, Saurabh Bansod <mth4saurabh> and Andreas Müller_.
Miscellaneous
- Fixed a bug when
datasets.make_classificationfails
when generating more than 30 features. 8159 by Herilalaina Rakotoarison <herilalaina>.
- Fixed a bug where
datasets.make_moonsgives an
incorrect result when `n_samples is odd. 8198 by Josh Levy <levy5674>`.
- Some `
fetch_functions insklearn.datasets` were ignoring the
`download_if_missing keyword. 7944 by Ralf Gommers <rgommers>`.
- Fix estimators to accept a `
sample_weight` parameter of type
`pandas.Series in their fit function. 7825 by Kathleen Chen`_.
- Fix a bug in cases where `
numpy.cumsum` may be numerically unstable,
raising an exception if instability is identified. 7376 and 7331 by Joel Nothman_ and yangarbiter.
- Fix a bug where
base.BaseEstimator.__getstate__
obstructed pickling customizations of child-classes, when used in a multiple inheritance context. 8316 by Holger Peters <HolgerPeters>.
- Update Sphinx-Gallery from 0.1.4 to 0.1.7 for resolving links in
documentation build with Sphinx>1.5 8010, 7986 by Oscar Najera <Titan-C>
- Add `
data_homeparameter tosklearn.datasets.fetch_kddcup99`.
9289 by Loic Esteve_.
- Fix dataset loaders using Python 3 version of makedirs to also work in
Python 2. 9284 by Sebastin Santy <SebastinSanty>.
- Several minor issues were fixed with thanks to the alerts of
lgtm.com <https://lgtm.com/>_. 9278 by Jean Helie <jhelie>, among others.
API changes summary
Trees and ensembles
- Gradient boosting base models are no longer estimators. By
Andreas Müller_.
- All tree-based estimators now accept a `
min_impurity_decrease`
parameter in lieu of the `min_impurity_split, which is now deprecated. The min_impurity_decrease helps stop splitting the nodes in which the weighted impurity decrease from splitting is no longer at least min_impurity_decrease. 8449 by Raghav RV`_.
Linear, kernelized and related models
- `
n_iterparameter is deprecated inlinear_model.SGDClassifier`,
linear_model.SGDRegressor, linear_model.PassiveAggressiveClassifier, linear_model.PassiveAggressiveRegressor and linear_model.Perceptron. By Tom Dupre la Tour_.
Other predictors
neighbors.LSHForesthas been deprecated and will be
removed in 0.21 due to poor performance. 9078 by Laurent Direr <ldirer>.
neighbors.NearestCentroidno longer purports to support
`metric='precomputed' which now raises an error. 8515 by Sergul Aydore <sergulaydore>`.
- The `
alphaparameter ofsemi_supervised.LabelPropagation` now
has no effect and is deprecated to be removed in 0.21. 9239 by Andre Ambrosio Boechat <boechat107>, :user:Utkarsh Upadhyay <musically-ut>, and Joel Nothman_.
Decomposition, manifold learning and clustering
- Deprecate the `
doc_topic_distrargument of theperplexity` method
in decomposition.LatentDirichletAllocation because the user no longer has access to the unnormalized document topic distribution needed for the perplexity calculation. 7954 by Gary Foreman <garyForeman>.
- The `
n_topicsparameter ofdecomposition.LatentDirichletAllocation`
has been renamed to `n_components and will be removed in version 0.21. 8922 by Attractadore`.
decomposition.SparsePCA.transform's `ridge_alpha` parameter is
deprecated in preference for class parameter. 8137 by Naoya Kanai <naoyak>.
cluster.DBSCANnow has a `metric_params` parameter.
8139 by Naoya Kanai <naoyak>.
Preprocessing and feature selection
feature_selection.SelectFromModelnow has a `partial_fit`
method only if the underlying estimator does. By Andreas Müller_.
feature_selection.SelectFromModelnow validates the `threshold`
parameter and sets the `threshold_ attribute during the call to fit, and no longer during the call to transform. By Andreas Müller`_.
- The `
non_negativeparameter infeature_extraction.FeatureHasher`
has been deprecated, and replaced with a more principled alternative, `alternate_sign. 7565 by Roman Yurchak <rth>`.
linear_model.RandomizedLogisticRegression,
and linear_model.RandomizedLasso have been deprecated and will be removed in version 0.21. 8995 by Ramana.S <sentient07>.
Model evaluation and meta-estimators
- Deprecate the `
fit_params` constructor input to the
model_selection.GridSearchCV and model_selection.RandomizedSearchCV in favor of passing keyword parameters to the `fit methods of those classes. Data-dependent parameters needed for model training should be passed as keyword arguments to fit, and conforming to this convention will allow the hyperparameter selection classes to be used with tools such as model_selection.cross_val_predict. 2879 by Stephen Hoover <stephen-hoover>`.
- In version 0.21, the default behavior of splitters that use the
`test_size and train_size parameter will change, such that specifying train_size alone will cause test_size to be the remainder. 7459 by Nelson Liu <nelson-liu>`.
multiclass.OneVsRestClassifiernow has `partial_fit`,
`decision_function and predict_proba methods only when the underlying estimator does. 7812 by Andreas Müller_ and Mikhail Korobov <kmike>`.
multiclass.OneVsRestClassifiernow has a `partial_fit` method
only if the underlying estimator does. By Andreas Müller_.
- The `
decision_function` output shape for binary classification in
multiclass.OneVsRestClassifier and multiclass.OneVsOneClassifier is now `(n_samples,) to conform to scikit-learn conventions. 9100 by Andreas Müller`_.
- The
multioutput.MultiOutputClassifier.predict_proba
function used to return a 3d array (`n_samples, n_classes, n_outputs). In the case where different target columns had different numbers of classes, a ValueError would be raised on trying to stack matrices with different dimensions. This function now returns a list of arrays where the length of the list is n_outputs, and each array is (n_samples, n_classes) for that particular output. 8093 by Peter Bull <pjbull>`.
- Replace attribute `
named_stepsdicttoutils.Bunch`
in pipeline.Pipeline to enable tab completion in interactive environment. In the case conflict value on `named_steps and dict attribute, dict behavior will be prioritized. 8481 by Herilalaina Rakotoarison <herilalaina>`.
Miscellaneous
- Deprecate the `
yparameter intransformandinverse_transform`.
The method should not accept `y parameter, as it's used at the prediction time. 8174 by Tahar Zanouda <tzano>, Alexandre Gramfort_ and Raghav RV`_.
- SciPy >= 0.13.3 and NumPy >= 1.8.2 are now the minimum supported versions
for scikit-learn. The following backported functions in sklearn.utils have been removed or deprecated accordingly. 8854 and 8874 by Naoya Kanai <naoyak>
- The `
store_covariancesandcovariances_` parameters of
discriminant_analysis.QuadraticDiscriminantAnalysis have been renamed to `store_covariance and covariance_ to be consistent with the corresponding parameter names of the discriminant_analysis.LinearDiscriminantAnalysis. They will be removed in version 0.21. 7998 by Jiacheng <mrbeann>`
Removed in 0.19:
- `
utils.fixes.argpartition` - `
utils.fixes.array_equal` - `
utils.fixes.astype` - `
utils.fixes.bincount` - `
utils.fixes.expit` - `
utils.fixes.frombuffer_empty` - `
utils.fixes.in1d` - `
utils.fixes.norm` - `
utils.fixes.rankdata` - `
utils.fixes.safe_copy`
Deprecated in 0.19, to be removed in 0.21:
- `
utils.arpack.eigs` - `
utils.arpack.eigsh` - `
utils.arpack.svds` - `
utils.extmath.fast_dot` - `
utils.extmath.logsumexp` - `
utils.extmath.norm` - `
utils.extmath.pinvh` - `
utils.graph.graph_laplacian` - `
utils.random.choice` - `
utils.sparsetools.connected_components` - `
utils.stats.rankdata`
- Estimators with both methods `
decision_functionandpredict_proba`
are now required to have a monotonic relation between them. The method `check_decision_proba_consistency has been added in **utils.estimator_checks** to check their consistency. 7578 by Shubham Bhardwaj <shubham0704>`
- All checks in `
utils.estimator_checks`, in particular
utils.estimator_checks.check_estimator now accept estimator instances. Most other checks do not accept estimator classes any more. 9019 by Andreas Müller_.
- Ensure that estimators' attributes ending with `
_` are not set
in the constructor but only in the `fit method. Most notably, ensemble estimators (deriving from ensemble.BaseEnsemble) now only have self.estimators_ available after fit. 7464 by Lars Buitinck_ and Loic Esteve`_.
Code and Documentation Contributors
Thanks to everyone who has contributed to the maintenance and improvement of the project since version 0.18, including:
Joel Nothman, Loic Esteve, Andreas Mueller, Guillaume Lemaitre, Olivier Grisel, Hanmin Qin, Raghav RV, Alexandre Gramfort, themrmax, Aman Dalmia, Gael Varoquaux, Naoya Kanai, Tom Dupré la Tour, Rishikesh, Nelson Liu, Taehoon Lee, Nelle Varoquaux, Aashil, Mikhail Korobov, Sebastin Santy, Joan Massich, Roman Yurchak, RAKOTOARISON Herilalaina, Thierry Guillemot, Alexandre Abadie, Carol Willing, Balakumaran Manoharan, Josh Karnofsky, Vlad Niculae, Utkarsh Upadhyay, Dmitry Petrov, Minghui Liu, Srivatsan, Vincent Pham, Albert Thomas, Jake VanderPlas, Attractadore, JC Liu, alexandercbooth, chkoar, Óscar Nájera, Aarshay Jain, Kyle Gilliam, Ramana Subramanyam, CJ Carey, Clement Joudet, David Robles, He Chen, Joris Van den Bossche, Karan Desai, Katie Luangkote, Leland McInnes, Maniteja Nandana, Michele Lacchia, Sergei Lebedev, Shubham Bhardwaj, akshay0724, omtcyfz, rickiepark, waterponey, Vathsala Achar, jbDelafosse, Ralf Gommers, Ekaterina Krivich, Vivek Kumar, Ishank Gulati, Dave Elliott, ldirer, Reiichiro Nakano, Levi John Wolf, Mathieu Blondel, Sid Kapur, Dougal J. Sutherland, midinas, mikebenfield, Sourav Singh, Aseem Bansal, Ibraim Ganiev, Stephen Hoover, AishwaryaRK, Steven C. Howell, Gary Foreman, Neeraj Gangwar, Tahar, Jon Crall, dokato, Kathy Chen, ferria, Thomas Moreau, Charlie Brummitt, Nicolas Goix, Adam Kleczewski, Sam Shleifer, Nikita Singh, Basil Beirouti, Giorgio Patrini, Manoj Kumar, Rafael Possas, James Bourbeau, James A. Bednar, Janine Harper, Jaye, Jean Helie, Jeremy Steward, Artsiom, John Wei, Jonathan LIgo, Jonathan Rahn, seanpwilliams, Arthur Mensch, Josh Levy, Julian Kuhlmann, Julien Aubert, Jörn Hees, Kai, shivamgargsya, Kat Hempstalk, Kaushik Lakshmikanth, Kennedy, Kenneth Lyons, Kenneth Myers, Kevin Yap, Kirill Bobyrev, Konstantin Podshumok, Arthur Imbert, Lee Murray, toastedcornflakes, Lera, Li Li, Arthur Douillard, Mainak Jas, tobycheese, Manraj Singh, Manvendra Singh, Marc Meketon, MarcoFalke, Matthew Brett, Matthias Gilch, Mehul Ahuja, Melanie Goetz, Meng, Peng, Michael Dezube, Michal Baumgartner, vibrantabhi19, Artem Golubin, Milen Paskov, Antonin Carette, Morikko, MrMjauh, NALEPA Emmanuel, Namiya, Antoine Wendlinger, Narine Kokhlikyan, NarineK, Nate Guerin, Angus Williams, Ang Lu, Nicole Vavrova, Nitish Pandey, Okhlopkov Daniil Olegovich, Andy Craze, Om Prakash, Parminder Singh, Patrick Carlson, Patrick Pei, Paul Ganssle, Paulo Haddad, Paweł Lorek, Peng Yu, Pete Bachant, Peter Bull, Peter Csizsek, Peter Wang, Pieter Arthur de Jong, Ping-Yao, Chang, Preston Parry, Puneet Mathur, Quentin Hibon, Andrew Smith, Andrew Jackson, 1kastner, Rameshwar Bhaskaran, Rebecca Bilbro, Remi Rampin, Andrea Esuli, Rob Hall, Robert Bradshaw, Romain Brault, Aman Pratik, Ruifeng Zheng, Russell Smith, Sachin Agarwal, Sailesh Choyal, Samson Tan, Samuël Weber, Sarah Brown, Sebastian Pölsterl, Sebastian Raschka, Sebastian Saeger, Alyssa Batula, Abhyuday Pratap Singh, Sergey Feldman, Sergul Aydore, Sharan Yalburgi, willduan, Siddharth Gupta, Sri Krishna, Almer, Stijn Tonk, Allen Riddell, Theofilos Papapanagiotou, Alison, Alexis Mignon, Tommy Boucher, Tommy Löfstedt, Toshihiro Kamishima, Tyler Folkman, Tyler Lanigan, Alexander Junge, Varun Shenoy, Victor Poughon, Vilhelm von Ehrenheim, Aleksandr Sandrovskii, Alan Yee, Vlasios Vasileiou, Warut Vijitbenjaronk, Yang Zhang, Yaroslav Halchenko, Yichuan Liu, Yuichi Fujikawa, affanv14, aivision2020, xor, andreh7, brady salz, campustrampus, Agamemnon Krasoulis, ditenberg, elena-sharova, filipj8, fukatani, gedeck, guiniol, guoci, hakaa1, hongkahjun, i-am-xhy, jakirkham, jaroslaw-weber, jayzed82, jeroko, jmontoyam, jonathan.striebel, josephsalmon, jschendel, leereeves, martin-hahn, mathurinm, mehak-sachdeva, mlewis1729, mlliou112, mthorrell, ndingwall, nuffe, yangarbiter, plagree, pldtc325, Breno Freitas, Brett Olsen, Brian A. Alfano, Brian Burns, polmauri, Brandon Carter, Charlton Austin, Chayant T15h, Chinmaya Pancholi, Christian Danielsen, Chung Yen, Chyi-Kwei Yau, pravarmahajan, DOHMATOB Elvis, Daniel LeJeune, Daniel Hnyk, Darius Morawiec, David DeTomaso, David Gasquez, David Haberthür, David Heryanto, David Kirkby, David Nicholson, rashchedrin, Deborah Gertrude Digges, Denis Engemann, Devansh D, Dickson, Bob Baxley, Don86, E. Lynch-Klarup, Ed Rogers, Elizabeth Ferriss, Ellen-Co2, Fabian Egli, Fang-Chieh Chou, Bing Tian Dai, Greg Stupp, Grzegorz Szpak, Bertrand Thirion, Hadrien Bertrand, Harizo Rajaona, zxcvbnius, Henry Lin, Holger Peters, Icyblade Dai, Igor Andriushchenko, Ilya, Isaac Laughlin, Iván Vallés, Aurélien Bellet, JPFrancoia, Jacob Schreiber, Asish Mahapatra