Skip to content

Commit ec7f039

Browse files
committed
Pushing the docs to dev/ for branch: main, commit 955ec74c3a40e838a6262f3c17e64024651a1ab3
1 parent 8899340 commit ec7f039

File tree

1,267 files changed

+6327
-6107
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,267 files changed

+6327
-6107
lines changed
Binary file not shown.

dev/_downloads/1b3f17ff0f112d5b77cbdb90f1c17046/plot_set_output.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,21 @@
6363
# means that the final logistic regression step contains the feature names of the input.
6464
clf[-1].feature_names_in_
6565

66+
# %%
67+
# .. note:: If one uses the method `set_params`, the transformer will be
68+
# replaced by a new one with the default output format.
69+
clf.set_params(standardscaler=StandardScaler())
70+
clf.fit(X_train, y_train)
71+
clf[-1].feature_names_in_
72+
73+
# %%
74+
# To keep the intended behavior, use `set_output` on the new transformer
75+
# beforehand
76+
scaler = StandardScaler().set_output(transform="pandas")
77+
clf.set_params(standardscaler=scaler)
78+
clf.fit(X_train, y_train)
79+
clf[-1].feature_names_in_
80+
6681
# %%
6782
# Next we load the titanic dataset to demonstrate `set_output` with
6883
# :class:`compose.ColumnTransformer` and heterogeneous data.
Binary file not shown.

dev/_downloads/e23929e86fa0a415fb85ef2834a3ff7d/plot_set_output.ipynb

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,42 @@
9797
"clf[-1].feature_names_in_"
9898
]
9999
},
100+
{
101+
"cell_type": "markdown",
102+
"metadata": {},
103+
"source": [
104+
"<div class=\"alert alert-info\"><h4>Note</h4><p>If one uses the method `set_params`, the transformer will be\n replaced by a new one with the default output format.</p></div>\n\n"
105+
]
106+
},
107+
{
108+
"cell_type": "code",
109+
"execution_count": null,
110+
"metadata": {
111+
"collapsed": false
112+
},
113+
"outputs": [],
114+
"source": [
115+
"clf.set_params(standardscaler=StandardScaler())\nclf.fit(X_train, y_train)\nclf[-1].feature_names_in_"
116+
]
117+
},
118+
{
119+
"cell_type": "markdown",
120+
"metadata": {},
121+
"source": [
122+
"To keep the intended behavior, use `set_output` on the new transformer\nbeforehand\n\n"
123+
]
124+
},
125+
{
126+
"cell_type": "code",
127+
"execution_count": null,
128+
"metadata": {
129+
"collapsed": false
130+
},
131+
"outputs": [],
132+
"source": [
133+
"scaler = StandardScaler().set_output(transform=\"pandas\")\nclf.set_params(standardscaler=scaler)\nclf.fit(X_train, y_train)\nclf[-1].feature_names_in_"
134+
]
135+
},
100136
{
101137
"cell_type": "markdown",
102138
"metadata": {},

dev/_downloads/scikit-learn-docs.zip

6.42 KB
Binary file not shown.
172 Bytes
-37 Bytes
129 Bytes
117 Bytes
53 Bytes

0 commit comments

Comments
 (0)