diff --git a/doc/whats_new/v0.22.rst b/doc/whats_new/v0.22.rst index 3d96489c48a72..898da8c81f833 100644 --- a/doc/whats_new/v0.22.rst +++ b/doc/whats_new/v0.22.rst @@ -14,17 +14,58 @@ refer to :ref:`sphx_glr_auto_examples_release_highlights_plot_release_highlights_0_22_0.py`. +Clear definition of the public API +---------------------------------- + +Scikit-learn has a public API, and a private API. + +We do our best not to break the public API, and to only introduce +backward-compatible changes that do not require any user action. However, in +cases where that's not possible, any change to the public API is subject to +a deprecation cycle of two minor versions. The private API isn't publicly +documented and isn't subject to any deprecation cycle, so users should not +rely on its stability. + +A function or object is public if it is documented in the `API Reference +`_ and if it can be +imported with an import path without leading underscores. For example +``sklearn.pipeline.make_pipeline`` is public, while +`sklearn.pipeline._name_estimators` is private. +``sklearn.ensemble._gb.BaseEnsemble`` is private too because the whole `_gb` +module is private. + +Up to 0.22, some tools were de-facto public (no leading underscore), while +they should have been private in the first place. In version 0.22, these +tools have been made properly private, and the public API space has been +cleaned. In addition, importing from most sub-modules is now deprecated: you +should for example use ``from sklearn.cluster import Birch`` instead of +``from sklearn.cluster.birch import Birch`` (in practice, ``birch.py`` has +been moved to ``_birch.py``). + +.. note:: + + All the tools in the public API should be documented in the `API + Reference `_. If you + find a public tool (without leading underscore) that isn't in the API + reference, that means it should either be private or documented. Please + let us know by opening an issue! + + Deprecations: using ``FutureWarning`` from now on ------------------------------------------------- When deprecating a feature, previous versions of scikit-learn used to raise a ``DeprecationWarning``. Since the ``DeprecationWarnings`` aren't shown by default by Python, scikit-learn needed to resort to a custom warning filter -that would always show the warnings. - -This filter is now removed, and starting from 0.22 scikit-learn will show -``FutureWarnings`` for deprecations. :pr:`15080` by `Nicolas Hug`_. +to always show the warnings. That filter would sometimes interfere +with users custom warning filters. +Starting from version 0.22, scikit-learn will show ``FutureWarnings`` for +deprecations, `as recommended by the Python documentation +`_. +``FutureWarnings`` are always shown by default by Python, so the custom +filter has been removed and scikit-learn no longer hinders with user +filters. :pr:`15080` by `Nicolas Hug`_. Changed models -------------- @@ -111,6 +152,12 @@ Changelog exposes an ``n_iter_`` indicating the maximum number of iterations performed on each seed. :pr:`15120` by `Adrin Jalali`_. +- |Fix| :class:`cluster.AgglomerativeClustering` and + :class:`cluster.FeatureAgglomeration` now raise an error if + `affinity='cosine'` and `X` has samples that are all-zeros. :pr:`7943` by + :user:`mthorrell`. + + :mod:`sklearn.compose` ...................... @@ -123,6 +170,12 @@ Changelog pass `**fit_params` to the underlying regressor. :pr:`14890` by :user:`Miguel Cabrera `. +- |Fix| The :class:`compose.ColumnTransformer` now requires the number of + features to be consistent between `fit` and `transform`. A `FutureWarning` + is raised now, and this will raise an error in 0.24. If the number of + features isn't consistent and negative indexing is used, an error is + raised. :pr:`14544` by `Adrin Jalali`_. + :mod:`sklearn.cross_decomposition` .................................. @@ -369,6 +422,10 @@ Changelog :class:`ensemble.HistGradientBoostingRegressor`. :pr:`13769` by `Nicolas Hug`_. +- |Enhancement| :func:`inspection.plot_partial_dependence` has been extended to + now support the new visualization API described in the :ref:`User Guide + `. :pr:`14646` by `Thomas Fan`_. + - |Enhancement| :func:`inspection.partial_dependence` accepts pandas DataFrame and :class:`pipeline.Pipeline` containing :class:`compose.ColumnTransformer`. :pr:`14028` by :user:`Guillaume Lemaitre `. @@ -520,6 +577,10 @@ Changelog ``multioutput`` parameter. :pr:`14732` by :user:`Agamemnon Krasoulis `. +- |Enhancement| 'roc_auc_ovr_weighted' and 'roc_auc_ovo_weighted' can now be + used as the :term:`scoring` parameter of model-selection tools. + :pr:`14417` by `Thomas Fan`_. + :mod:`sklearn.model_selection` .............................. @@ -545,6 +606,11 @@ Changelog `random_state` is set but `shuffle` is False. This will raise an error in 0.24. +- |Fix| The `cv_results_` attribute of :class:`model_selection.GridSearchCV` + and :class:`model_selection.RandomizedSearchCV` now only contains unfitted + estimators. This potentially saves a lot of memory since the state of the + estimators isn't stored. :pr:`#15096` by :user:`Andreas Müller `. + :mod:`sklearn.multioutput` .......................... @@ -617,6 +683,9 @@ Changelog :mod:`sklearn.preprocessing` ............................ +- |Efficiency| :class:`preprocessing.PolynomialFeatures` is now faster when + the input data is dense. :pr:`13290` by :user:`Xavier Dupré `. + - |Enhancement| Avoid unnecessary data copy when fitting preprocessors :class:`preprocessing.StandardScaler`, :class:`preprocessing.MinMaxScaler`, :class:`preprocessing.MaxAbsScaler`, :class:`preprocessing.RobustScaler` @@ -776,7 +845,7 @@ Miscellaneous - |Fix| Port `lobpcg` from SciPy which implement some bug fixes but only available in 1.3+. - :pr:`13609` by :user:`Guillaume Lemaitre `. + :pr:`13609` and :pr:`14971` by :user:`Guillaume Lemaitre `. Changes to estimator checks --------------------------- @@ -812,3 +881,7 @@ These changes mostly affect library developers. :pr:`13392` by :user:`Rok Mihevc `. - |Fix| Added ``check_transformer_data_not_an_array`` to checks where missing + +- |Fix| The estimators tags resolution now follows the regular MRO. They used + to be overridable only once. :pr:`14884` by :user:`Andreas Müller + `. \ No newline at end of file