Skip to content

Commit 58c6f78

Browse files
committed
Pushing the docs to dev/ for branch: main, commit e4a7edc4aec597cba8b2bbce704772c7872e55f8
1 parent a4476b3 commit 58c6f78

File tree

1,234 files changed

+5164
-4912
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,234 files changed

+5164
-4912
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: b9f175218537e76fd189e9201b1a1414
3+
config: c09677a24a3c9c3d4e9b637554da2b91
44
tags: 645f666f9bcd5a90fca523b33c5a78b7
Binary file not shown.
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
"""
2+
===========================================
3+
Displaying estimators and complex pipelines
4+
===========================================
5+
6+
This example illustrates different ways estimators and pipelines can be
7+
displayed.
8+
"""
9+
10+
from sklearn.pipeline import make_pipeline
11+
from sklearn.preprocessing import OneHotEncoder, StandardScaler
12+
from sklearn.impute import SimpleImputer
13+
from sklearn.compose import make_column_transformer
14+
from sklearn.linear_model import LogisticRegression
15+
16+
17+
# %%
18+
# Compact text representation
19+
# ---------------------------
20+
#
21+
# Estimators will only show the parameters that have been set to non-default
22+
# values when displayed as a string. This reduces the visual noise and makes it
23+
# easier to spot what the differences are when comparing instances.
24+
25+
lr = LogisticRegression(penalty="l1")
26+
print(lr)
27+
28+
# %%
29+
# Rich HTML representation
30+
# ------------------------
31+
# In notebooks estimators and pipelines will use a rich HTML representation.
32+
# This is particularly useful to summarise the
33+
# structure of pipelines and other composite estimators, with interactivity to
34+
# provide detail. Click on the example image below to expand Pipeline
35+
# elements. See :ref:`visualizing_composite_estimators` for how you can use
36+
# this feature.
37+
38+
num_proc = make_pipeline(SimpleImputer(strategy="median"), StandardScaler())
39+
40+
cat_proc = make_pipeline(
41+
SimpleImputer(strategy="constant", fill_value="missing"),
42+
OneHotEncoder(handle_unknown="ignore"),
43+
)
44+
45+
preprocessor = make_column_transformer(
46+
(num_proc, ("feat1", "feat3")), (cat_proc, ("feat0", "feat2"))
47+
)
48+
49+
clf = make_pipeline(preprocessor, LogisticRegression())
50+
clf
Binary file not shown.

dev/_downloads/73b204eec0616bad4b738d300bf5c030/plot_changed_only_pprint_parameter.ipynb

Lines changed: 0 additions & 54 deletions
This file was deleted.

dev/_downloads/9a745322d64077b9b29de6e2eee95cb8/plot_changed_only_pprint_parameter.py

Lines changed: 0 additions & 30 deletions
This file was deleted.
Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
{
2+
"cells": [
3+
{
4+
"cell_type": "code",
5+
"execution_count": null,
6+
"metadata": {
7+
"collapsed": false
8+
},
9+
"outputs": [],
10+
"source": [
11+
"%matplotlib inline"
12+
]
13+
},
14+
{
15+
"cell_type": "markdown",
16+
"metadata": {},
17+
"source": [
18+
"\n# Displaying estimators and complex pipelines\n\nThis example illustrates different ways estimators and pipelines can be\ndisplayed.\n"
19+
]
20+
},
21+
{
22+
"cell_type": "code",
23+
"execution_count": null,
24+
"metadata": {
25+
"collapsed": false
26+
},
27+
"outputs": [],
28+
"source": [
29+
"from sklearn.pipeline import make_pipeline\nfrom sklearn.preprocessing import OneHotEncoder, StandardScaler\nfrom sklearn.impute import SimpleImputer\nfrom sklearn.compose import make_column_transformer\nfrom sklearn.linear_model import LogisticRegression"
30+
]
31+
},
32+
{
33+
"cell_type": "markdown",
34+
"metadata": {},
35+
"source": [
36+
"## Compact text representation\n\nEstimators will only show the parameters that have been set to non-default\nvalues when displayed as a string. This reduces the visual noise and makes it\neasier to spot what the differences are when comparing instances.\n\n"
37+
]
38+
},
39+
{
40+
"cell_type": "code",
41+
"execution_count": null,
42+
"metadata": {
43+
"collapsed": false
44+
},
45+
"outputs": [],
46+
"source": [
47+
"lr = LogisticRegression(penalty=\"l1\")\nprint(lr)"
48+
]
49+
},
50+
{
51+
"cell_type": "markdown",
52+
"metadata": {},
53+
"source": [
54+
"## Rich HTML representation\nIn notebooks estimators and pipelines will use a rich HTML representation.\nThis is particularly useful to summarise the\nstructure of pipelines and other composite estimators, with interactivity to\nprovide detail. Click on the example image below to expand Pipeline\nelements. See `visualizing_composite_estimators` for how you can use\nthis feature.\n\n"
55+
]
56+
},
57+
{
58+
"cell_type": "code",
59+
"execution_count": null,
60+
"metadata": {
61+
"collapsed": false
62+
},
63+
"outputs": [],
64+
"source": [
65+
"num_proc = make_pipeline(SimpleImputer(strategy=\"median\"), StandardScaler())\n\ncat_proc = make_pipeline(\n SimpleImputer(strategy=\"constant\", fill_value=\"missing\"),\n OneHotEncoder(handle_unknown=\"ignore\"),\n)\n\npreprocessor = make_column_transformer(\n (num_proc, (\"feat1\", \"feat3\")), (cat_proc, (\"feat0\", \"feat2\"))\n)\n\nclf = make_pipeline(preprocessor, LogisticRegression())\nclf"
66+
]
67+
}
68+
],
69+
"metadata": {
70+
"kernelspec": {
71+
"display_name": "Python 3",
72+
"language": "python",
73+
"name": "python3"
74+
},
75+
"language_info": {
76+
"codemirror_mode": {
77+
"name": "ipython",
78+
"version": 3
79+
},
80+
"file_extension": ".py",
81+
"mimetype": "text/x-python",
82+
"name": "python",
83+
"nbconvert_exporter": "python",
84+
"pygments_lexer": "ipython3",
85+
"version": "3.9.13"
86+
}
87+
},
88+
"nbformat": 4,
89+
"nbformat_minor": 0
90+
}

dev/_downloads/scikit-learn-docs.zip

-3.93 KB
Binary file not shown.
-4 Bytes
-156 Bytes

0 commit comments

Comments
 (0)