Skip to content

Commit d7cd1ad

Browse files
committed
Pushing the docs to dev/ for branch: main, commit e70fb3f91b00f59899c63dc32cd8fc9162284b60
1 parent fd8a888 commit d7cd1ad

File tree

1,252 files changed

+5828
-4769
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,252 files changed

+5828
-4769
lines changed

dev/.buildinfo

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
# Sphinx build info version 1
22
# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done.
3-
config: e0ac0c348c7ea2f94ac060292c73c566
3+
config: 6bd680f9b86afba8d49c158b84a862d3
44
tags: 645f666f9bcd5a90fca523b33c5a78b7
Binary file not shown.
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
# flake8: noqa
2+
"""
3+
=======================================
4+
Release Highlights for scikit-learn 1.2
5+
=======================================
6+
7+
.. currentmodule:: sklearn
8+
9+
We are pleased to announce the release of scikit-learn 1.2! Many bug fixes
10+
and improvements were added, as well as some new key features. We detail
11+
below a few of the major features of this release. **For an exhaustive list of
12+
all the changes**, please refer to the :ref:`release notes <changes_1_2>`.
13+
14+
To install the latest version (with pip)::
15+
16+
pip install --upgrade scikit-learn
17+
18+
or with conda::
19+
20+
conda install -c conda-forge scikit-learn
21+
22+
"""
23+
24+
# %%
25+
# Pandas output with `set_output` API
26+
# -----------------------------------
27+
# scikit-learn's transformers now support pandas output with the `set_output` API.
28+
# To learn more about the `set_output` API see the example:
29+
# :ref:`sphx_glr_auto_examples_miscellaneous_plot_set_output.py` and
30+
# # this `video, pandas DataFrame output for scikit-learn transformers
31+
# (some examples) <https://youtu.be/5bCg8VfX2x8>`__.
32+
33+
import numpy as np
34+
from sklearn.datasets import load_iris
35+
from sklearn.preprocessing import StandardScaler, KBinsDiscretizer
36+
from sklearn.compose import ColumnTransformer
37+
38+
X, y = load_iris(as_frame=True, return_X_y=True)
39+
sepal_cols = ["sepal length (cm)", "sepal width (cm)"]
40+
petal_cols = ["petal length (cm)", "petal width (cm)"]
41+
42+
preprocessor = ColumnTransformer(
43+
[
44+
("scaler", StandardScaler(), sepal_cols),
45+
("kbin", KBinsDiscretizer(encode="ordinal"), petal_cols),
46+
],
47+
verbose_feature_names_out=False,
48+
).set_output(transform="pandas")
49+
50+
X_out = preprocessor.fit_transform(X)
51+
X_out.sample(n=5, random_state=0)
52+
53+
# %%
54+
# Interaction constraints in Histogram-based Gradient Boosting Trees
55+
# ------------------------------------------------------------------
56+
# :class:`~ensemble.HistGradientBoostingRegressor` and
57+
# :class:`~ensemble.HistGradientBoostingClassifier` now supports interaction constraints
58+
# with the `interaction_cst` parameter. For details, see the
59+
# :ref:`User Guide <interaction_cst_hgbt>`. In the following example, features are not
60+
# allowed to interact.
61+
from sklearn.datasets import load_diabetes
62+
from sklearn.ensemble import HistGradientBoostingRegressor
63+
64+
X, y = load_diabetes(return_X_y=True, as_frame=True)
65+
66+
hist_no_interact = HistGradientBoostingRegressor(
67+
interaction_cst=[[i] for i in range(X.shape[1])], random_state=0
68+
)
69+
hist_no_interact.fit(X, y)
70+
71+
# %%
72+
# Experimental Array API support in :class:`~discriminant_analysis.LinearDiscriminantAnalysis`
73+
# --------------------------------------------------------------------------------------------
74+
# Experimental support for the `Array API <https://data-apis.org/array-api/latest/>`_
75+
# specification was added to :class:`~discriminant_analysis.LinearDiscriminantAnalysis`.
76+
# The estimator can now run on any Array API compliant libraries such as
77+
# `CuPy <https://docs.cupy.dev/en/stable/overview.html>`__, a GPU-accelerated array
78+
# library. For details, see the :ref:`User Guide <array_api>`.

0 commit comments

Comments
 (0)