
.. DO NOT EDIT.
.. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY.
.. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE:
.. "auto_examples/release_highlights/plot_release_highlights_0_24_0.py"
.. LINE NUMBERS ARE GIVEN BELOW.

.. only:: html

    .. note::
        :class: sphx-glr-download-link-note

        Click :ref:`here <sphx_glr_download_auto_examples_release_highlights_plot_release_highlights_0_24_0.py>`
        to download the full example code

.. rst-class:: sphx-glr-example-title

.. _sphx_glr_auto_examples_release_highlights_plot_release_highlights_0_24_0.py:


========================================
Release Highlights for scikit-learn 0.24
========================================

.. currentmodule:: sklearn

We are pleased to announce the release of scikit-learn 0.24! Many bug fixes
and improvements were added, as well as some new key features. We detail
below a few of the major features of this release. **For an exhaustive list of
all the changes**, please refer to the :ref:`release notes <release_notes_0_24>`.

To install the latest version (with pip)::

    pip install --upgrade scikit-learn

or with conda::

    conda install -c conda-forge scikit-learn

.. GENERATED FROM PYTHON SOURCE LINES 25-51

Successive Halving estimators for tuning hyper-parameters
---------------------------------------------------------
Successive Halving, a state of the art method, is now available to
explore the space of the parameters and identify their best combination.
:class:`~sklearn.model_selection.HalvingGridSearchCV` and
:class:`~sklearn.model_selection.HalvingRandomSearchCV` can be
used as drop-in replacement for
:class:`~sklearn.model_selection.GridSearchCV` and
:class:`~sklearn.model_selection.RandomizedSearchCV`.
Successive Halving is an iterative selection process illustrated in the
figure below. The first iteration is run with a small amount of resources,
where the resource typically corresponds to the number of training samples,
but can also be an arbitrary integer parameter such as `n_estimators` in a
random forest. Only a subset of the parameter candidates are selected for the
next iteration, which will be run with an increasing amount of allocated
resources. Only a subset of candidates will last until the end of the
iteration process, and the best parameter candidate is the one that has the
highest score on the last iteration.

Read more in the :ref:`User Guide <successive_halving_user_guide>` (note:
the Successive Halving estimators are still :term:`experimental
<experimental>`).

.. figure:: ../model_selection/images/sphx_glr_plot_successive_halving_iterations_001.png
  :target: ../model_selection/plot_successive_halving_iterations.html
  :align: center

.. GENERATED FROM PYTHON SOURCE LINES 51-79

.. code-block:: default


    import numpy as np
    from scipy.stats import randint
    from sklearn.experimental import enable_halving_search_cv  # noqa
    from sklearn.model_selection import HalvingRandomSearchCV
    from sklearn.ensemble import RandomForestClassifier
    from sklearn.datasets import make_classification

    rng = np.random.RandomState(0)

    X, y = make_classification(n_samples=700, random_state=rng)

    clf = RandomForestClassifier(n_estimators=10, random_state=rng)

    param_dist = {
        "max_depth": [3, None],
        "max_features": randint(1, 11),
        "min_samples_split": randint(2, 11),
        "bootstrap": [True, False],
        "criterion": ["gini", "entropy"],
    }

    rsh = HalvingRandomSearchCV(
        estimator=clf, param_distributions=param_dist, factor=2, random_state=rng
    )
    rsh.fit(X, y)
    rsh.best_params_





.. rst-class:: sphx-glr-script-out

 Out:

 .. code-block:: none


    {'bootstrap': True, 'criterion': 'gini', 'max_depth': None, 'max_features': 10, 'min_samples_split': 10}



.. GENERATED FROM PYTHON SOURCE LINES 80-99

Native support for categorical features in HistGradientBoosting estimators
--------------------------------------------------------------------------
:class:`~sklearn.ensemble.HistGradientBoostingClassifier` and
:class:`~sklearn.ensemble.HistGradientBoostingRegressor` now have native
support for categorical features: they can consider splits on non-ordered,
categorical data. Read more in the :ref:`User Guide
<categorical_support_gbdt>`.

.. figure:: ../ensemble/images/sphx_glr_plot_gradient_boosting_categorical_001.png
  :target: ../ensemble/plot_gradient_boosting_categorical.html
  :align: center

The plot shows that the new native support for categorical features leads to
fitting times that are comparable to models where the categories are treated
as ordered quantities, i.e. simply ordinal-encoded. Native support is also
more expressive than both one-hot encoding and ordinal encoding. However, to
use the new `categorical_features` parameter, it is still required to
preprocess the data within a pipeline as demonstrated in this :ref:`example
<sphx_glr_auto_examples_ensemble_plot_gradient_boosting_categorical.py>`.

.. GENERATED FROM PYTHON SOURCE LINES 101-109

Improved performances of HistGradientBoosting estimators
--------------------------------------------------------
The memory footprint of :class:`ensemble.HistGradientBoostingRegressor` and
:class:`ensemble.HistGradientBoostingClassifier` has been significantly
improved during calls to `fit`. In addition, histogram initialization is now
done in parallel which results in slight speed improvements.
See more in the `Benchmark page
<https://scikit-learn.org/scikit-learn-benchmarks/>`_.

.. GENERATED FROM PYTHON SOURCE LINES 111-119

New self-training meta-estimator
--------------------------------
A new self-training implementation, based on `Yarowski's algorithm
<https://doi.org/10.3115/981658.981684>`_ can now be used with any
classifier that implements :term:`predict_proba`. The sub-classifier
will behave as a
semi-supervised classifier, allowing it to learn from unlabeled data.
Read more in the :ref:`User guide <self_training>`.

.. GENERATED FROM PYTHON SOURCE LINES 119-133

.. code-block:: default


    import numpy as np
    from sklearn import datasets
    from sklearn.semi_supervised import SelfTrainingClassifier
    from sklearn.svm import SVC

    rng = np.random.RandomState(42)
    iris = datasets.load_iris()
    random_unlabeled_points = rng.rand(iris.target.shape[0]) < 0.3
    iris.target[random_unlabeled_points] = -1
    svc = SVC(probability=True, gamma="auto")
    self_training_model = SelfTrainingClassifier(svc)
    self_training_model.fit(iris.data, iris.target)






.. raw:: html

    <div class="output_subarea output_html rendered_html output_result">
    <style>#sk-container-id-2 {
      /* Definition of color scheme common for light and dark mode */
      --sklearn-color-text: black;
      --sklearn-color-line: gray;
      /* Definition of color scheme for unfitted estimators */
      --sklearn-color-unfitted-level-0: #fff5e6;
      --sklearn-color-unfitted-level-1: #f6e4d2;
      --sklearn-color-unfitted-level-2: #ffe0b3;
      --sklearn-color-unfitted-level-3: chocolate;
      /* Definition of color scheme for fitted estimators */
      --sklearn-color-fitted-level-0: #f0f8ff;
      --sklearn-color-fitted-level-1: #d4ebff;
      --sklearn-color-fitted-level-2: #b3dbfd;
      --sklearn-color-fitted-level-3: cornflowerblue;

      /* Specific color for light theme */
      --sklearn-color-text-on-default-background: var(--sg-text-color, var(--theme-code-foreground, var(--jp-content-font-color1, black)));
      --sklearn-color-background: var(--sg-background-color, var(--theme-background, var(--jp-layout-color0, white)));
      --sklearn-color-border-box: var(--sg-text-color, var(--theme-code-foreground, var(--jp-content-font-color1, black)));
      --sklearn-color-icon: #696969;

      @media (prefers-color-scheme: dark) {
        /* Redefinition of color scheme for dark theme */
        --sklearn-color-text-on-default-background: var(--sg-text-color, var(--theme-code-foreground, var(--jp-content-font-color1, white)));
        --sklearn-color-background: var(--sg-background-color, var(--theme-background, var(--jp-layout-color0, #111)));
        --sklearn-color-border-box: var(--sg-text-color, var(--theme-code-foreground, var(--jp-content-font-color1, white)));
        --sklearn-color-icon: #878787;
      }
    }

    #sk-container-id-2 {
      color: var(--sklearn-color-text);
    }

    #sk-container-id-2 pre {
      padding: 0;
    }

    #sk-container-id-2 input.sk-hidden--visually {
      border: 0;
      clip: rect(1px 1px 1px 1px);
      clip: rect(1px, 1px, 1px, 1px);
      height: 1px;
      margin: -1px;
      overflow: hidden;
      padding: 0;
      position: absolute;
      width: 1px;
    }

    #sk-container-id-2 div.sk-dashed-wrapped {
      border: 1px dashed var(--sklearn-color-line);
      margin: 0 0.4em 0.5em 0.4em;
      box-sizing: border-box;
      padding-bottom: 0.4em;
      background-color: var(--sklearn-color-background);
    }

    #sk-container-id-2 div.sk-container {
      /* jupyter's `normalize.less` sets `[hidden] { display: none; }`
         but bootstrap.min.css set `[hidden] { display: none !important; }`
         so we also need the `!important` here to be able to override the
         default hidden behavior on the sphinx rendered scikit-learn.org.
         See: https://github.com/scikit-learn/scikit-learn/issues/21755 */
      display: inline-block !important;
      position: relative;
    }

    #sk-container-id-2 div.sk-text-repr-fallback {
      display: none;
    }

    div.sk-parallel-item,
    div.sk-serial,
    div.sk-item {
      /* draw centered vertical line to link estimators */
      background-image: linear-gradient(var(--sklearn-color-text-on-default-background), var(--sklearn-color-text-on-default-background));
      background-size: 2px 100%;
      background-repeat: no-repeat;
      background-position: center center;
    }

    /* Parallel-specific style estimator block */

    #sk-container-id-2 div.sk-parallel-item::after {
      content: "";
      width: 100%;
      border-bottom: 2px solid var(--sklearn-color-text-on-default-background);
      flex-grow: 1;
    }

    #sk-container-id-2 div.sk-parallel {
      display: flex;
      align-items: stretch;
      justify-content: center;
      background-color: var(--sklearn-color-background);
      position: relative;
    }

    #sk-container-id-2 div.sk-parallel-item {
      display: flex;
      flex-direction: column;
    }

    #sk-container-id-2 div.sk-parallel-item:first-child::after {
      align-self: flex-end;
      width: 50%;
    }

    #sk-container-id-2 div.sk-parallel-item:last-child::after {
      align-self: flex-start;
      width: 50%;
    }

    #sk-container-id-2 div.sk-parallel-item:only-child::after {
      width: 0;
    }

    /* Serial-specific style estimator block */

    #sk-container-id-2 div.sk-serial {
      display: flex;
      flex-direction: column;
      align-items: center;
      background-color: var(--sklearn-color-background);
      padding-right: 1em;
      padding-left: 1em;
    }


    /* Toggleable style: style used for estimator/Pipeline/ColumnTransformer box that is
    clickable and can be expanded/collapsed.
    - Pipeline and ColumnTransformer use this feature and define the default style
    - Estimators will overwrite some part of the style using the `sk-estimator` class
    */

    /* Pipeline and ColumnTransformer style (default) */

    #sk-container-id-2 div.sk-toggleable {
      /* Default theme specific background. It is overwritten whether we have a
      specific estimator or a Pipeline/ColumnTransformer */
      background-color: var(--sklearn-color-background);
    }

    /* Toggleable label */
    #sk-container-id-2 label.sk-toggleable__label {
      cursor: pointer;
      display: block;
      width: 100%;
      margin-bottom: 0;
      padding: 0.5em;
      box-sizing: border-box;
      text-align: center;
    }

    #sk-container-id-2 label.sk-toggleable__label-arrow:before {
      /* Arrow on the left of the label */
      content: "▸";
      float: left;
      margin-right: 0.25em;
      color: var(--sklearn-color-icon);
    }

    #sk-container-id-2 label.sk-toggleable__label-arrow:hover:before {
      color: var(--sklearn-color-text);
    }

    /* Toggleable content - dropdown */

    #sk-container-id-2 div.sk-toggleable__content {
      max-height: 0;
      max-width: 0;
      overflow: hidden;
      text-align: left;
      /* unfitted */
      background-color: var(--sklearn-color-unfitted-level-0);
    }

    #sk-container-id-2 div.sk-toggleable__content.fitted {
      /* fitted */
      background-color: var(--sklearn-color-fitted-level-0);
    }

    #sk-container-id-2 div.sk-toggleable__content pre {
      margin: 0.2em;
      border-radius: 0.25em;
      color: var(--sklearn-color-text);
      /* unfitted */
      background-color: var(--sklearn-color-unfitted-level-0);
    }

    #sk-container-id-2 div.sk-toggleable__content.fitted pre {
      /* unfitted */
      background-color: var(--sklearn-color-fitted-level-0);
    }

    #sk-container-id-2 input.sk-toggleable__control:checked~div.sk-toggleable__content {
      /* Expand drop-down */
      max-height: 200px;
      max-width: 100%;
      overflow: auto;
    }

    #sk-container-id-2 input.sk-toggleable__control:checked~label.sk-toggleable__label-arrow:before {
      content: "▾";
    }

    /* Pipeline/ColumnTransformer-specific style */

    #sk-container-id-2 div.sk-label input.sk-toggleable__control:checked~label.sk-toggleable__label {
      color: var(--sklearn-color-text);
      background-color: var(--sklearn-color-unfitted-level-2);
    }

    #sk-container-id-2 div.sk-label.fitted input.sk-toggleable__control:checked~label.sk-toggleable__label {
      background-color: var(--sklearn-color-fitted-level-2);
    }

    /* Estimator-specific style */

    /* Colorize estimator box */
    #sk-container-id-2 div.sk-estimator input.sk-toggleable__control:checked~label.sk-toggleable__label {
      /* unfitted */
      background-color: var(--sklearn-color-unfitted-level-2);
    }

    #sk-container-id-2 div.sk-estimator.fitted input.sk-toggleable__control:checked~label.sk-toggleable__label {
      /* fitted */
      background-color: var(--sklearn-color-fitted-level-2);
    }

    #sk-container-id-2 div.sk-label label.sk-toggleable__label,
    #sk-container-id-2 div.sk-label label {
      /* The background is the default theme color */
      color: var(--sklearn-color-text-on-default-background);
    }

    /* On hover, darken the color of the background */
    #sk-container-id-2 div.sk-label:hover label.sk-toggleable__label {
      color: var(--sklearn-color-text);
      background-color: var(--sklearn-color-unfitted-level-2);
    }

    /* Label box, darken color on hover, fitted */
    #sk-container-id-2 div.sk-label.fitted:hover label.sk-toggleable__label.fitted {
      color: var(--sklearn-color-text);
      background-color: var(--sklearn-color-fitted-level-2);
    }

    /* Estimator label */

    #sk-container-id-2 div.sk-label label {
      font-family: monospace;
      font-weight: bold;
      display: inline-block;
      line-height: 1.2em;
    }

    #sk-container-id-2 div.sk-label-container {
      text-align: center;
    }

    /* Estimator-specific */
    #sk-container-id-2 div.sk-estimator {
      font-family: monospace;
      border: 1px dotted var(--sklearn-color-border-box);
      border-radius: 0.25em;
      box-sizing: border-box;
      margin-bottom: 0.5em;
      /* unfitted */
      background-color: var(--sklearn-color-unfitted-level-0);
    }

    #sk-container-id-2 div.sk-estimator.fitted {
      /* fitted */
      background-color: var(--sklearn-color-fitted-level-0);
    }

    /* on hover */
    #sk-container-id-2 div.sk-estimator:hover {
      /* unfitted */
      background-color: var(--sklearn-color-unfitted-level-2);
    }

    #sk-container-id-2 div.sk-estimator.fitted:hover {
      /* fitted */
      background-color: var(--sklearn-color-fitted-level-2);
    }

    /* Specification for estimator info (e.g. "i" and "?") */

    /* Common style for "i" and "?" */

    .sk-estimator-doc-link,
    a:link.sk-estimator-doc-link,
    a:visited.sk-estimator-doc-link {
      float: right;
      font-size: smaller;
      line-height: 1em;
      font-family: monospace;
      background-color: var(--sklearn-color-background);
      border-radius: 1em;
      height: 1em;
      width: 1em;
      text-decoration: none !important;
      margin-left: 1ex;
      /* unfitted */
      border: var(--sklearn-color-unfitted-level-1) 1pt solid;
      color: var(--sklearn-color-unfitted-level-1);
    }

    .sk-estimator-doc-link.fitted,
    a:link.sk-estimator-doc-link.fitted,
    a:visited.sk-estimator-doc-link.fitted {
      /* fitted */
      border: var(--sklearn-color-fitted-level-1) 1pt solid;
      color: var(--sklearn-color-fitted-level-1);
    }

    /* On hover */
    div.sk-estimator:hover .sk-estimator-doc-link:hover,
    .sk-estimator-doc-link:hover,
    div.sk-label-container:hover .sk-estimator-doc-link:hover,
    .sk-estimator-doc-link:hover {
      /* unfitted */
      background-color: var(--sklearn-color-unfitted-level-3);
      color: var(--sklearn-color-background);
      text-decoration: none;
    }

    div.sk-estimator.fitted:hover .sk-estimator-doc-link.fitted:hover,
    .sk-estimator-doc-link.fitted:hover,
    div.sk-label-container:hover .sk-estimator-doc-link.fitted:hover,
    .sk-estimator-doc-link.fitted:hover {
      /* fitted */
      background-color: var(--sklearn-color-fitted-level-3);
      color: var(--sklearn-color-background);
      text-decoration: none;
    }

    /* Span, style for the box shown on hovering the info icon */
    .sk-estimator-doc-link span {
      display: none;
      z-index: 9999;
      position: relative;
      font-weight: normal;
      right: .2ex;
      padding: .5ex;
      margin: .5ex;
      width: min-content;
      min-width: 20ex;
      max-width: 50ex;
      color: var(--sklearn-color-text);
      box-shadow: 2pt 2pt 4pt #999;
      /* unfitted */
      background: var(--sklearn-color-unfitted-level-0);
      border: .5pt solid var(--sklearn-color-unfitted-level-3);
    }

    .sk-estimator-doc-link.fitted span {
      /* fitted */
      background: var(--sklearn-color-fitted-level-0);
      border: var(--sklearn-color-fitted-level-3);
    }

    .sk-estimator-doc-link:hover span {
      display: block;
    }

    /* "?"-specific style due to the `<a>` HTML tag */

    #sk-container-id-2 a.estimator_doc_link {
      float: right;
      font-size: 1rem;
      line-height: 1em;
      font-family: monospace;
      background-color: var(--sklearn-color-background);
      border-radius: 1rem;
      height: 1rem;
      width: 1rem;
      text-decoration: none;
      /* unfitted */
      color: var(--sklearn-color-unfitted-level-1);
      border: var(--sklearn-color-unfitted-level-1) 1pt solid;
    }

    #sk-container-id-2 a.estimator_doc_link.fitted {
      /* fitted */
      border: var(--sklearn-color-fitted-level-1) 1pt solid;
      color: var(--sklearn-color-fitted-level-1);
    }

    /* On hover */
    #sk-container-id-2 a.estimator_doc_link:hover {
      /* unfitted */
      background-color: var(--sklearn-color-unfitted-level-3);
      color: var(--sklearn-color-background);
      text-decoration: none;
    }

    #sk-container-id-2 a.estimator_doc_link.fitted:hover {
      /* fitted */
      background-color: var(--sklearn-color-fitted-level-3);
    }
    </style><div id="sk-container-id-2" class="sk-top-container"><div class="sk-text-repr-fallback"><pre>SelfTrainingClassifier(base_estimator=SVC(gamma=&#x27;auto&#x27;, probability=True))</pre><b>In a Jupyter environment, please rerun this cell to show the HTML representation or trust the notebook. <br />On GitHub, the HTML representation is unable to render, please try loading this page with nbviewer.org.</b></div><div class="sk-container" hidden><div class="sk-item sk-dashed-wrapped"><div class="sk-label-container"><div class="sk-label fitted sk-toggleable"><input class="sk-toggleable__control sk-hidden--visually" id="sk-estimator-id-2" type="checkbox" ><label for="sk-estimator-id-2" class="sk-toggleable__label fitted sk-toggleable__label-arrow fitted">&nbsp;&nbsp;SelfTrainingClassifier<a class="sk-estimator-doc-link fitted" rel="noreferrer" target="_blank" href="https://scikit-learn.org/1.4/modules/generated/sklearn.semi_supervised.SelfTrainingClassifier.html">?<span>Documentation for SelfTrainingClassifier</span></a><span class="sk-estimator-doc-link fitted">i<span>Fitted</span></span></label><div class="sk-toggleable__content fitted"><pre>SelfTrainingClassifier(base_estimator=SVC(gamma=&#x27;auto&#x27;, probability=True))</pre></div> </div></div><div class="sk-parallel"><div class="sk-parallel-item"><div class="sk-item"><div class="sk-label-container"><div class="sk-label fitted sk-toggleable"><input class="sk-toggleable__control sk-hidden--visually" id="sk-estimator-id-3" type="checkbox" ><label for="sk-estimator-id-3" class="sk-toggleable__label fitted sk-toggleable__label-arrow fitted">base_estimator: SVC</label><div class="sk-toggleable__content fitted"><pre>SVC(gamma=&#x27;auto&#x27;, probability=True)</pre></div> </div></div><div class="sk-serial"><div class="sk-item"><div class="sk-estimator fitted sk-toggleable"><input class="sk-toggleable__control sk-hidden--visually" id="sk-estimator-id-4" type="checkbox" ><label for="sk-estimator-id-4" class="sk-toggleable__label fitted sk-toggleable__label-arrow fitted">&nbsp;SVC<a class="sk-estimator-doc-link fitted" rel="noreferrer" target="_blank" href="https://scikit-learn.org/1.4/modules/generated/sklearn.svm.SVC.html">?<span>Documentation for SVC</span></a></label><div class="sk-toggleable__content fitted"><pre>SVC(gamma=&#x27;auto&#x27;, probability=True)</pre></div> </div></div></div></div></div></div></div></div></div>
    </div>
    <br />
    <br />

.. GENERATED FROM PYTHON SOURCE LINES 134-142

New SequentialFeatureSelector transformer
-----------------------------------------
A new iterative transformer to select features is available:
:class:`~sklearn.feature_selection.SequentialFeatureSelector`.
Sequential Feature Selection can add features one at a time (forward
selection) or remove features from the list of the available features
(backward selection), based on a cross-validated score maximization.
See the :ref:`User Guide <sequential_feature_selection>`.

.. GENERATED FROM PYTHON SOURCE LINES 142-157

.. code-block:: default


    from sklearn.feature_selection import SequentialFeatureSelector
    from sklearn.neighbors import KNeighborsClassifier
    from sklearn.datasets import load_iris

    X, y = load_iris(return_X_y=True, as_frame=True)
    feature_names = X.columns
    knn = KNeighborsClassifier(n_neighbors=3)
    sfs = SequentialFeatureSelector(knn, n_features_to_select=2)
    sfs.fit(X, y)
    print(
        "Features selected by forward sequential selection: "
        f"{feature_names[sfs.get_support()].tolist()}"
    )





.. rst-class:: sphx-glr-script-out

 Out:

 .. code-block:: none

    Features selected by forward sequential selection: ['sepal length (cm)', 'petal width (cm)']




.. GENERATED FROM PYTHON SOURCE LINES 158-164

New PolynomialCountSketch kernel approximation function
-------------------------------------------------------
The new :class:`~sklearn.kernel_approximation.PolynomialCountSketch`
approximates a polynomial expansion of a feature space when used with linear
models, but uses much less memory than
:class:`~sklearn.preprocessing.PolynomialFeatures`.

.. GENERATED FROM PYTHON SOURCE LINES 164-183

.. code-block:: default


    from sklearn.datasets import fetch_covtype
    from sklearn.pipeline import make_pipeline
    from sklearn.model_selection import train_test_split
    from sklearn.preprocessing import MinMaxScaler
    from sklearn.kernel_approximation import PolynomialCountSketch
    from sklearn.linear_model import LogisticRegression

    X, y = fetch_covtype(return_X_y=True)
    pipe = make_pipeline(
        MinMaxScaler(),
        PolynomialCountSketch(degree=2, n_components=300),
        LogisticRegression(max_iter=1000),
    )
    X_train, X_test, y_train, y_test = train_test_split(
        X, y, train_size=5000, test_size=10000, random_state=42
    )
    pipe.fit(X_train, y_train).score(X_test, y_test)



.. rst-class:: sphx-glr-script-out

.. code-block:: pytb

    Traceback (most recent call last):
      File "/build/scikit-learn-Ye5PqW/scikit-learn-1.4.1.post1+dfsg/examples/release_highlights/plot_release_highlights_0_24_0.py", line 172, in <module>
        X, y = fetch_covtype(return_X_y=True)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/build/scikit-learn-Ye5PqW/scikit-learn-1.4.1.post1+dfsg/.pybuild/cpython3_3.12/build/sklearn/utils/_param_validation.py", line 213, in wrapper
        return func(*args, **kwargs)
               ^^^^^^^^^^^^^^^^^^^^^
      File "/build/scikit-learn-Ye5PqW/scikit-learn-1.4.1.post1+dfsg/.pybuild/cpython3_3.12/build/sklearn/datasets/_covtype.py", line 186, in fetch_covtype
        archive_path = _fetch_remote(ARCHIVE, dirname=temp_dir)
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/build/scikit-learn-Ye5PqW/scikit-learn-1.4.1.post1+dfsg/.pybuild/cpython3_3.12/build/sklearn/datasets/_base.py", line 1432, in _fetch_remote
        raise IOError('Debian Policy Section 4.9 prohibits network access during build')
    OSError: Debian Policy Section 4.9 prohibits network access during build




.. GENERATED FROM PYTHON SOURCE LINES 184-185

For comparison, here is the score of a linear baseline for the same data:

.. GENERATED FROM PYTHON SOURCE LINES 185-189

.. code-block:: default


    linear_baseline = make_pipeline(MinMaxScaler(), LogisticRegression(max_iter=1000))
    linear_baseline.fit(X_train, y_train).score(X_test, y_test)


.. GENERATED FROM PYTHON SOURCE LINES 190-196

Individual Conditional Expectation plots
----------------------------------------
A new kind of partial dependence plot is available: the Individual
Conditional Expectation (ICE) plot. ICE plots visualize the dependence of the
prediction on a feature for each sample separately, with one line per sample.
See the :ref:`User Guide <individual_conditional>`

.. GENERATED FROM PYTHON SOURCE LINES 196-227

.. code-block:: default


    from sklearn.ensemble import RandomForestRegressor
    from sklearn.datasets import fetch_california_housing

    # from sklearn.inspection import plot_partial_dependence
    from sklearn.inspection import PartialDependenceDisplay

    X, y = fetch_california_housing(return_X_y=True, as_frame=True)
    features = ["MedInc", "AveOccup", "HouseAge", "AveRooms"]
    est = RandomForestRegressor(n_estimators=10)
    est.fit(X, y)

    # plot_partial_dependence has been removed in version 1.2. From 1.2, use
    # PartialDependenceDisplay instead.
    # display = plot_partial_dependence(
    display = PartialDependenceDisplay.from_estimator(
        est,
        X,
        features,
        kind="individual",
        subsample=50,
        n_jobs=3,
        grid_resolution=20,
        random_state=0,
    )
    display.figure_.suptitle(
        "Partial dependence of house value on non-location features\n"
        "for the California housing dataset, with BayesianRidge"
    )
    display.figure_.subplots_adjust(hspace=0.3)


.. GENERATED FROM PYTHON SOURCE LINES 228-234

New Poisson splitting criterion for DecisionTreeRegressor
---------------------------------------------------------
The integration of Poisson regression estimation continues from version 0.23.
:class:`~sklearn.tree.DecisionTreeRegressor` now supports a new `'poisson'`
splitting criterion. Setting `criterion="poisson"` might be a good choice
if your target is a count or a frequency.

.. GENERATED FROM PYTHON SOURCE LINES 234-248

.. code-block:: default


    from sklearn.tree import DecisionTreeRegressor
    from sklearn.model_selection import train_test_split
    import numpy as np

    n_samples, n_features = 1000, 20
    rng = np.random.RandomState(0)
    X = rng.randn(n_samples, n_features)
    # positive integer target correlated with X[:, 5] with many zeros:
    y = rng.poisson(lam=np.exp(X[:, 5]) / 2)
    X_train, X_test, y_train, y_test = train_test_split(X, y, random_state=rng)
    regressor = DecisionTreeRegressor(criterion="poisson", random_state=0)
    regressor.fit(X_train, y_train)


.. GENERATED FROM PYTHON SOURCE LINES 249-265

New documentation improvements
------------------------------

New examples and documentation pages have been added, in a continuous effort
to improve the understanding of machine learning practices:

- a new section about :ref:`common pitfalls and recommended
  practices <common_pitfalls>`,
- an example illustrating how to :ref:`statistically compare the performance of
  models <sphx_glr_auto_examples_model_selection_plot_grid_search_stats.py>`
  evaluated using :class:`~sklearn.model_selection.GridSearchCV`,
- an example on how to :ref:`interpret coefficients of linear models
  <sphx_glr_auto_examples_inspection_plot_linear_model_coefficient_interpretation.py>`,
- an :ref:`example
  <sphx_glr_auto_examples_cross_decomposition_plot_pcr_vs_pls.py>`
  comparing Principal Component Regression and Partial Least Squares.


.. rst-class:: sphx-glr-timing

   **Total running time of the script:** ( 0 minutes  5.024 seconds)


.. _sphx_glr_download_auto_examples_release_highlights_plot_release_highlights_0_24_0.py:


.. only :: html

 .. container:: sphx-glr-footer
    :class: sphx-glr-footer-example



  .. container:: sphx-glr-download sphx-glr-download-python

     :download:`Download Python source code: plot_release_highlights_0_24_0.py <plot_release_highlights_0_24_0.py>`



  .. container:: sphx-glr-download sphx-glr-download-jupyter

     :download:`Download Jupyter notebook: plot_release_highlights_0_24_0.ipynb <plot_release_highlights_0_24_0.ipynb>`


.. only:: html

 .. rst-class:: sphx-glr-signature

    `Gallery generated by Sphinx-Gallery <https://sphinx-gallery.github.io>`_
