Skip to content

Commit d75355a

Browse files
committed
Pushing the docs to dev/ for branch: master, commit 76de8833195e8f4ebeaefd65e29e9b429fa2a4e7
1 parent 6b92b29 commit d75355a

File tree

1,201 files changed

+4148
-4147
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,201 files changed

+4148
-4147
lines changed
Binary file not shown.

dev/_downloads/51a82a09a4aa0f703f69fb5d4f15104f/plot_partial_dependence_visualization_api.ipynb

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,14 @@
2626
},
2727
"outputs": [],
2828
"source": [
29-
"print(__doc__)\n\nimport pandas as pd\nimport matplotlib.pyplot as plt\nfrom sklearn.datasets import load_boston\nfrom sklearn.neural_network import MLPRegressor\nfrom sklearn.preprocessing import StandardScaler\nfrom sklearn.pipeline import make_pipeline\nfrom sklearn.tree import DecisionTreeRegressor\nfrom sklearn.inspection import plot_partial_dependence"
29+
"print(__doc__)\n\nimport pandas as pd\nimport matplotlib.pyplot as plt\nfrom sklearn.datasets import load_diabetes\nfrom sklearn.neural_network import MLPRegressor\nfrom sklearn.preprocessing import StandardScaler\nfrom sklearn.pipeline import make_pipeline\nfrom sklearn.tree import DecisionTreeRegressor\nfrom sklearn.inspection import plot_partial_dependence"
3030
]
3131
},
3232
{
3333
"cell_type": "markdown",
3434
"metadata": {},
3535
"source": [
36-
"Train models on the boston housing price dataset\n================================================\n\nFirst, we train a decision tree and a multi-layer perceptron on the boston\nhousing price dataset.\n\n"
36+
"Train models on the diabetes dataset\n================================================\n\nFirst, we train a decision tree and a multi-layer perceptron on the diabetes\ndataset.\n\n"
3737
]
3838
},
3939
{
@@ -44,14 +44,14 @@
4444
},
4545
"outputs": [],
4646
"source": [
47-
"boston = load_boston()\nX = pd.DataFrame(boston.data, columns=boston.feature_names)\ny = boston.target\n\ntree = DecisionTreeRegressor()\nmlp = make_pipeline(StandardScaler(),\n MLPRegressor(hidden_layer_sizes=(100, 100),\n tol=1e-2, max_iter=500, random_state=0))\ntree.fit(X, y)\nmlp.fit(X, y)"
47+
"diabetes = load_diabetes()\nX = pd.DataFrame(diabetes.data, columns=diabetes.feature_names)\ny = diabetes.target\n\ntree = DecisionTreeRegressor()\nmlp = make_pipeline(StandardScaler(),\n MLPRegressor(hidden_layer_sizes=(100, 100),\n tol=1e-2, max_iter=500, random_state=0))\ntree.fit(X, y)\nmlp.fit(X, y)"
4848
]
4949
},
5050
{
5151
"cell_type": "markdown",
5252
"metadata": {},
5353
"source": [
54-
"Plotting partial dependence for two features\n============================================\n\nWe plot partial dependence curves for features \"LSTAT\" and \"RM\" for\nthe decision tree. With two features,\n:func:`~sklearn.inspection.plot_partial_dependence` expects to plot two\ncurves. Here the plot function place a grid of two plots using the space\ndefined by `ax` .\n\n"
54+
"Plotting partial dependence for two features\n============================================\n\nWe plot partial dependence curves for features \"age\" and \"bmi\" (body mass\nindex) for the decision tree. With two features,\n:func:`~sklearn.inspection.plot_partial_dependence` expects to plot two\ncurves. Here the plot function place a grid of two plots using the space\ndefined by `ax` .\n\n"
5555
]
5656
},
5757
{
@@ -62,7 +62,7 @@
6262
},
6363
"outputs": [],
6464
"source": [
65-
"fig, ax = plt.subplots(figsize=(12, 6))\nax.set_title(\"Decision Tree\")\ntree_disp = plot_partial_dependence(tree, X, [\"LSTAT\", \"RM\"], ax=ax)"
65+
"fig, ax = plt.subplots(figsize=(12, 6))\nax.set_title(\"Decision Tree\")\ntree_disp = plot_partial_dependence(tree, X, [\"age\", \"bmi\"], ax=ax)"
6666
]
6767
},
6868
{
@@ -80,7 +80,7 @@
8080
},
8181
"outputs": [],
8282
"source": [
83-
"fig, ax = plt.subplots(figsize=(12, 6))\nax.set_title(\"Multi-layer Perceptron\")\nmlp_disp = plot_partial_dependence(mlp, X, [\"LSTAT\", \"RM\"], ax=ax,\n line_kw={\"c\": \"red\"})"
83+
"fig, ax = plt.subplots(figsize=(12, 6))\nax.set_title(\"Multi-layer Perceptron\")\nmlp_disp = plot_partial_dependence(mlp, X, [\"age\", \"bmi\"], ax=ax,\n line_kw={\"c\": \"red\"})"
8484
]
8585
},
8686
{
@@ -141,7 +141,7 @@
141141
"cell_type": "markdown",
142142
"metadata": {},
143143
"source": [
144-
"Plotting partial dependence for one feature\n===========================================\n\nHere, we plot the partial dependence curves for a single feature, \"LSTAT\", on\nthe same axes. In this case, `tree_disp.axes_` is passed into the second\nplot function.\n\n"
144+
"Plotting partial dependence for one feature\n===========================================\n\nHere, we plot the partial dependence curves for a single feature, \"age\", on\nthe same axes. In this case, `tree_disp.axes_` is passed into the second\nplot function.\n\n"
145145
]
146146
},
147147
{
@@ -152,7 +152,7 @@
152152
},
153153
"outputs": [],
154154
"source": [
155-
"tree_disp = plot_partial_dependence(tree, X, [\"LSTAT\"])\nmlp_disp = plot_partial_dependence(mlp, X, [\"LSTAT\"],\n ax=tree_disp.axes_, line_kw={\"c\": \"red\"})"
155+
"tree_disp = plot_partial_dependence(tree, X, [\"age\"])\nmlp_disp = plot_partial_dependence(mlp, X, [\"age\"],\n ax=tree_disp.axes_, line_kw={\"c\": \"red\"})"
156156
]
157157
}
158158
],

dev/_downloads/781bb5a2dc85df6b75ee78d2eb118b0b/plot_partial_dependence_visualization_api.py

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
import pandas as pd
1919
import matplotlib.pyplot as plt
20-
from sklearn.datasets import load_boston
20+
from sklearn.datasets import load_diabetes
2121
from sklearn.neural_network import MLPRegressor
2222
from sklearn.preprocessing import StandardScaler
2323
from sklearn.pipeline import make_pipeline
@@ -26,15 +26,15 @@
2626

2727

2828
##############################################################################
29-
# Train models on the boston housing price dataset
29+
# Train models on the diabetes dataset
3030
# ================================================
3131
#
32-
# First, we train a decision tree and a multi-layer perceptron on the boston
33-
# housing price dataset.
32+
# First, we train a decision tree and a multi-layer perceptron on the diabetes
33+
# dataset.
3434

35-
boston = load_boston()
36-
X = pd.DataFrame(boston.data, columns=boston.feature_names)
37-
y = boston.target
35+
diabetes = load_diabetes()
36+
X = pd.DataFrame(diabetes.data, columns=diabetes.feature_names)
37+
y = diabetes.target
3838

3939
tree = DecisionTreeRegressor()
4040
mlp = make_pipeline(StandardScaler(),
@@ -43,19 +43,18 @@
4343
tree.fit(X, y)
4444
mlp.fit(X, y)
4545

46-
4746
##############################################################################
4847
# Plotting partial dependence for two features
4948
# ============================================
5049
#
51-
# We plot partial dependence curves for features "LSTAT" and "RM" for
52-
# the decision tree. With two features,
50+
# We plot partial dependence curves for features "age" and "bmi" (body mass
51+
# index) for the decision tree. With two features,
5352
# :func:`~sklearn.inspection.plot_partial_dependence` expects to plot two
5453
# curves. Here the plot function place a grid of two plots using the space
5554
# defined by `ax` .
5655
fig, ax = plt.subplots(figsize=(12, 6))
5756
ax.set_title("Decision Tree")
58-
tree_disp = plot_partial_dependence(tree, X, ["LSTAT", "RM"], ax=ax)
57+
tree_disp = plot_partial_dependence(tree, X, ["age", "bmi"], ax=ax)
5958

6059
##############################################################################
6160
# The partial depdendence curves can be plotted for the multi-layer perceptron.
@@ -64,7 +63,7 @@
6463
# the curve.
6564
fig, ax = plt.subplots(figsize=(12, 6))
6665
ax.set_title("Multi-layer Perceptron")
67-
mlp_disp = plot_partial_dependence(mlp, X, ["LSTAT", "RM"], ax=ax,
66+
mlp_disp = plot_partial_dependence(mlp, X, ["age", "bmi"], ax=ax,
6867
line_kw={"c": "red"})
6968

7069
##############################################################################
@@ -124,14 +123,13 @@
124123
tree_disp.axes_[0, 1].legend()
125124
plt.show()
126125

127-
128126
##############################################################################
129127
# Plotting partial dependence for one feature
130128
# ===========================================
131129
#
132-
# Here, we plot the partial dependence curves for a single feature, "LSTAT", on
130+
# Here, we plot the partial dependence curves for a single feature, "age", on
133131
# the same axes. In this case, `tree_disp.axes_` is passed into the second
134132
# plot function.
135-
tree_disp = plot_partial_dependence(tree, X, ["LSTAT"])
136-
mlp_disp = plot_partial_dependence(mlp, X, ["LSTAT"],
133+
tree_disp = plot_partial_dependence(tree, X, ["age"])
134+
mlp_disp = plot_partial_dependence(mlp, X, ["age"],
137135
ax=tree_disp.axes_, line_kw={"c": "red"})
Binary file not shown.

dev/_downloads/scikit-learn-docs.pdf

27.2 KB
Binary file not shown.

dev/_images/iris.png

0 Bytes
22 Bytes
22 Bytes
-623 Bytes
-623 Bytes

0 commit comments

Comments
 (0)