Skip to content

Latest commit

 

History

History
424 lines (328 loc) · 18.1 KB

v0.21.rst

File metadata and controls

424 lines (328 loc) · 18.1 KB

sklearn

Version 0.21.0

In development

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.

  • linear_model.BayesianRidge
  • Decision trees and derived ensembles when both max_depth and max_leaf_nodes are set.
  • linear_model.LogisticRegression and linear_model.LogisticRegressionCV with 'saga' solver.
  • ensemble.GradientBoostingClassifier for multiclass classification.
  • svm.SVC.decision_function and multiclass.OneVsOneClassifier.decision_function.

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

Support for Python 3.4 and below has been officially dropped.

sklearn.calibration

  • Added support to bin the data passed into calibration.calibration_curve by quantiles instead of uniformly between 0 and 1. 13086 by Scott Cole <srcole>.

sklearn.cluster

  • A new clustering algorithm: cluster.OPTICS: an algoritm related to cluster.DBSCAN, that has hyperparameters easier to set and that scales better, by Shane <espg>, Adrin Jalali <adrinjalali>, and Erich Schubert <kno10>.

sklearn.datasets

  • Added support for 64-bit group IDs and pointers in SVMLight files datasets.svmlight_format 10727 by Bryan K Woods <bryan-woods>.
  • datasets.load_sample_images returns images with a deterministic order. 13250 by Thomas Fan <thomasjpfan>.

sklearn.decomposition

  • The default value of the init argument in decomposition.non_negative_factorization will change from random to None in version 0.23 to make it consistent with decomposition.NMF. A FutureWarning is raised when the default value is used. 12988 by Zijie (ZJ) Poh <zjpoh>.
  • Fixed a bug in decomposition.NMF where init = 'nndsvd', init = 'nndsvda', and init = 'nndsvdar' are allowed when n_components < n_features instead of n_components <= min(n_samples, n_features). 11650 by Hossein Pourbozorg <hossein-pourbozorg> and Zijie (ZJ) Poh <zjpoh>.
  • decomposition.KernelPCA now has deterministic output (resolved sign ambiguity in eigenvalue decomposition of the kernel matrix). 13241 by Aurélien Bellet <bellet>.

sklearn.discriminant_analysis

  • discriminant_analysis.LinearDiscriminantAnalysis now preserves float32 and float64 dtypes. 8769 and 11000 by Thibault Sejourne <thibsej>
  • A ChangedBehaviourWarning is now raised when discriminant_analysis.LinearDiscriminantAnalysis is given as parameter n_components > min(n_features, n_classes - 1), and n_components is changed to min(n_features, n_classes - 1) if so. Previously the change was made, but silently. 11526 by William de Vazelhes<wdevazelhes>.

sklearn.dummy

  • Fixed a bug in dummy.DummyClassifier where the predict_proba method was returning int32 array instead of float64 for the stratified strategy. 13266 by Christos Aridas<chkoar>.

sklearn.ensemble

  • Make ensemble.IsolationForest prefer threads over processes when running with n_jobs > 1 as the underlying decision tree fit calls do release the GIL. This changes reduces memory usage and communication overhead. 12543 by Isaac Storch <istorch> and Olivier Grisel.
  • Fixed the output of the average path length computed in ensemble.IsolationForest when the input is either 0, 1 or 2. 13251 by Albert Thomas <albertcthomas> and joshuakennethjones <joshuakennethjones>.
  • Fixed a bug in ensemble.GradientBoostingClassifier where the gradients would be incorrectly computed in multiclass classification problems. 12715 by Nicolas Hug<NicolasHug>.
  • Fixed a bug in ensemble where the predict method would error for multiclass multioutput forests models if any targets were strings. 12834 by Elizabeth Sander <elsander>.
  • Fixed a bug in ensemble.gradient_boosting.LossFunction and ensemble.gradient_boosting.LeastSquaresError where the default value of learning_rate in update_terminal_regions is not consistent with the document and the caller functions. 6463 by movelikeriver <movelikeriver>.
  • Minimized the validation of X in ensemble.AdaBoostClassifier and ensemble.AdaBoostRegressor 13174 by Christos Aridas <chkoar>.

sklearn.externals

  • Deprecated externals.six since we have dropped support for Python 2.7. 12916 by Hanmin Qin <qinhanmin2014>.

sklearn.impute

  • Added impute.IterativeImputer, which is a strategy for imputing missing values by modeling each feature with missing values as a function of other features in a round-robin fashion. 8478 and 12177 by Sergey Feldman <sergeyf> Ben Lawson <benlawson>.
  • In impute.MissingIndicator avoid implicit densification by raising an exception if input is sparse add missing_values property is set to 0. 13240 by Bartosz Telenczuk <btel>.

sklearn.linear_model

  • linear_model.make_dataset now preserves float32 and float64 dtypes. 8769 and 11000 by Nelle Varoquaux_, Arthur Imbert <Henley13>, Guillaume Lemaitre <glemaitre>, and Joan Massich <massich>
  • linear_model.LogisticRegression and linear_model.LogisticRegressionCV now support Elastic-Net penalty, with the 'saga' solver. 11646 by Nicolas Hug <NicolasHug>.
  • linear_model.LogisticRegression now supports an unregularized objective by setting penalty to 'none'. This is equivalent to setting C=np.inf with l2 regularization. Not supported by the liblinear solver. 12860 by Nicolas Hug <NicolasHug>.
  • Fixed a bug in linear_model.LogisticRegression and linear_model.LogisticRegressionCV with 'saga' solver, where the weights would not be correctly updated in some cases. 11646 by Tom Dupre la Tour.
  • Fixed the posterior mean, posterior covariance and returned regularization parameters in linear_model.BayesianRidge. The posterior mean and the posterior covariance were not the ones computed with the last update of the regularization parameters and the returned regularization parameters were not the final ones. Also fixed the formula of the log marginal likelihood used to compute the score when compute_score=True. 12174 by Albert Thomas <albertcthomas>.
  • linear_model.logistic_regression_path is deprecated in version 0.21 and will be removed in version 0.23. 12821 by Nicolas Hug <NicolasHug>.
  • Fixed a bug in linear_model.LassoLarsIC, where user input

    copy_X=False at instance creation would be overridden by default parameter value copy_X=True in fit. 12972 by Lucio Fernandez-Arjona <luk-f-a>

  • Fixed a bug in linear_model.LinearRegression that was not returning the same coeffecients and intercepts with fit_intercept=True in sparse and dense case. 13279 by Alexandre Gramfort

sklearn.manifold

  • Make manifold.tsne.trustworthiness use an inverted index instead of an np.where lookup to find the rank of neighbors in the input space. This improves efficiency in particular when computed with lots of neighbors and/or small datasets. 9907 by William de Vazelhes <wdevazelhes>.

sklearn.metrics

  • Faster metrics.pairwise.pairwise_distances with n_jobs > 1 by using a thread-based backend, instead of process-based backends. 8216 by Pierre Glaser <pierreglaser> and Romuald Menuet <zanospi>
  • Added the metrics.max_error metric and a corresponding 'max_error' scorer for single output regression. 12232 by Krishna Sangeeth <whiletruelearn>.
  • Add metrics.multilabel_confusion_matrix, which calculates a confusion matrix with true positive, false positive, false negative and true negative counts for each class. This facilitates the calculation of set-wise metrics such as recall, specificity, fall out and miss rate. 11179 by Shangwu Yao <ShangwuYao> and Joel Nothman.
  • Use label accuracy instead of micro-average on metrics.classification_report to avoid confusion. micro-average is only shown for multi-label or multi-class with a subset of classes because it is otherwise identical to accuracy. 12334 by Emmanuel Arias <eamanu@eamanu.com>, Joel Nothman and Andreas Müller
  • The parameter labels in metrics.hamming_loss is deprecated in version 0.21 and will be removed in version 0.23. 10580 by Reshama Shaikh <reshamas> and Sandra Mitrovic <SandraMNE>.
  • The metric metrics.r2_score is degenerate with a single sample and now it returns NaN and raises exceptions.UndefinedMetricWarning. 12855 by Pawel Sendyk <psendyk>.
  • The pairwise manhattan distances with sparse input now uses the BLAS shipped with scipy instead of the bundled BLAS. 12732 by Jérémie du Boisberranger <jeremiedbb>

sklearn.model_selection

  • Classes ~model_selection.GridSearchCV and ~model_selection.RandomizedSearchCV now allow for refit=callable to add flexibility in identifying the best estimator. An example for this interface has been added. 11354 by Wenhao Zhang <wenhaoz@ucla.edu>, Joel Nothman and Adrin Jalali <adrinjalali>.
  • Classes ~model_selection.GridSearchCV, ~model_selection.RandomizedSearchCV, and methods ~model_selection.cross_val_score, ~model_selection.cross_val_predict, ~model_selection.cross_validate, now print train scores when return_train_scores is True and verbose > 2. For ~model_selection.learning_curve, and ~model_selection.validation_curve only the latter is required. 12613 and 12669 by Marc Torrellas <marctorrellas>.
  • 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

  • A metric learning algorithm: neighbors.NeighborhoodComponentsAnalysis, which implements the Neighborhood Components Analysis algorithm described in Goldberger et al. (2005). 10058 by William de Vazelhes <wdevazelhes> and John Chiotellis <johny-c>.
  • Methods in neighbors.NearestNeighbors : ~neighbors.NearestNeighbors.kneighbors, ~neighbors.NearestNeighbors.radius_neighbors, ~neighbors.NearestNeighbors.kneighbors_graph, ~neighbors.NearestNeighbors.radius_neighbors_graph now raise NotFittedError, rather than AttributeError, when called before fit 12279 by Krishna Sangeeth <whiletruelearn>.

sklearn.neural_network

  • Fixed a bug in neural_network.MLPClassifier and neural_network.MLPRegressor where the option shuffle=False was being ignored. 12582 by Sam Waterbury <samwaterbury>.

sklearn.pipeline

  • pipeline.Pipeline now supports using 'passthrough' as a transformer. 11144 by Thomas Fan <thomasjpfan>.

sklearn.preprocessing

  • Make preprocessing.MultiLabelBinarizer to cache class mappings instead of calculating it every time on the fly. 12116 by Ekaterina Krivich <kiote> and Joel Nothman.
  • preprocessing.PolynomialFeatures now supports compressed sparse row (CSR) matrices as input for degrees 2 and 3. This is typically much faster than the dense case as it scales with matrix density and expansion degree (on the order of density^degree), and is much, much faster than the compressed sparse column (CSC) case. 12197 by Andrew Nystrom <awnystrom>.
  • Speed improvement in preprocessing.PolynomialFeatures, in the dense case. Also added a new parameter order which controls output order for further speed performances. 12251 by Tom Dupre la Tour.
  • Fixed the calculation overflow when using a float16 dtype with preprocessing.StandardScaler. 13007 by Raffaello Baluyot <baluyotraf>
  • OneHotEncoder now supports dropping one feature per category with a new drop parameter. 12908 by Drew Johnston <drewmjohnston>.

sklearn.tree

  • Decision Trees can now be plotted with matplotlib using tree.plot_tree without relying on the dot library, removing a hard-to-install dependency. 8508 by Andreas Müller.
  • Decision Trees can now be exported in a human readable textual format using tree.export.export_text. 6261 by Giuseppe Vettigli <JustGlowing>.
  • get_n_leaves() and get_depth() have been added to tree.BaseDecisionTree and consequently all estimators based on it, including tree.DecisionTreeClassifier, tree.DecisionTreeRegressor, tree.ExtraTreeClassifier, and tree.ExtraTreeRegressor. 12300 by Adrin Jalali <adrinjalali>.
  • Fixed an issue with tree.BaseDecisionTree and consequently all estimators based on it, including tree.DecisionTreeClassifier, tree.DecisionTreeRegressor, tree.ExtraTreeClassifier, and tree.ExtraTreeRegressor, where they used to exceed the given max_depth by 1 while expanding the tree if max_leaf_nodes and max_depth were both specified by the user. Please note that this also affects all ensemble methods using decision trees. 12344 by Adrin Jalali <adrinjalali>.

sklearn.mixture

  • Fixed a bug in mixture.BaseMixture and therefore on estimators based on it, i.e. mixture.GaussianMixture and mixture.BayesianGaussianMixture, where fit_predict and fit.predict were not equivalent. 13142 by Jérémie du Boisberranger <jeremiedbb>.

sklearn.isotonic

  • Allow different dtypes (such as float32) in isotonic.IsotonicRegression 8769 by Vlad Niculae <vene>

sklearn.svm

  • Fixed an issue in svm.SVC.decision_function when decision_function_shape='ovr'. The decision_function value of a given sample was different depending on whether the decision_function was evaluated on the sample alone or on a batch containing this same sample due to the scaling used in decision_function. 10440 by Jonathan Ohayon <Johayon>.

sklearn.multiclass

  • Fixed an issue in multiclass.OneVsOneClassifier.decision_function where the decision_function value of a given sample was different depending on whether the decision_function was evaluated on the sample alone or on a batch containing this same sample due to the scaling used in decision_function. 10440 by Jonathan Ohayon <Johayon>.

Multiple modules

  • The __repr__() method of all estimators (used when calling print(estimator)) has been entirely re-written, building on Python's pretty printing standard library. All parameters are printed by default, but this can be altered with the print_changed_only option in sklearn.set_config. 11705 by Nicolas Hug <NicolasHug>.

Changes to estimator checks

These changes mostly affect library developers.

  • Add check_fit_idempotent to ~utils.estimator_checks.check_estimator, which checks that when fit is called twice with the same data, the ouput of predict, predict_proba, transform, and decision_function does not change. 12328 by Nicolas Hug <NicolasHug>