Skip to content

Commit 082bbac

Browse files
committed
Pushing the docs to dev/ for branch: main, commit 111c78214cb92d8a21c95734c6dd0e76d5398db2
1 parent aeed5a7 commit 082bbac

File tree

1,232 files changed

+4514
-4482
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,232 files changed

+4514
-4482
lines changed
Binary file not shown.

Diff for: dev/_downloads/21b82d82985712b5de6347f382c77c86/plot_partial_dependence.ipynb

+4-4
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@
6969
},
7070
"outputs": [],
7171
"source": [
72-
"import matplotlib.pyplot as plt\nfrom sklearn.inspection import partial_dependence\nfrom sklearn.inspection import PartialDependenceDisplay\n\nprint(\"Computing partial dependence plots...\")\ntic = time()\nfeatures = [\"MedInc\", \"AveOccup\", \"HouseAge\", \"AveRooms\"]\ndisplay = PartialDependenceDisplay.from_estimator(\n est,\n X_train,\n features,\n kind=\"both\",\n subsample=50,\n n_jobs=3,\n grid_resolution=20,\n random_state=0,\n ice_lines_kw={\"color\": \"tab:blue\", \"alpha\": 0.2, \"linewidth\": 0.5},\n pd_line_kw={\"color\": \"tab:orange\", \"linestyle\": \"--\"},\n)\nprint(f\"done in {time() - tic:.3f}s\")\ndisplay.figure_.suptitle(\n \"Partial dependence of house value on non-location features\\n\"\n \"for the California housing dataset, with MLPRegressor\"\n)\ndisplay.figure_.subplots_adjust(hspace=0.3)"
72+
"from sklearn.inspection import PartialDependenceDisplay\n\ncommon_params = {\"subsample\": 50, \"n_jobs\": 2, \"grid_resolution\": 20, \"random_state\": 0}\n\nprint(\"Computing partial dependence plots...\")\ntic = time()\ndisplay = PartialDependenceDisplay.from_estimator(\n est,\n X_train,\n features=[\"MedInc\", \"AveOccup\", \"HouseAge\", \"AveRooms\"],\n kind=\"both\",\n **common_params,\n)\nprint(f\"done in {time() - tic:.3f}s\")\ndisplay.figure_.suptitle(\n \"Partial dependence of house value on non-location features\\n\"\n \"for the California housing dataset, with MLPRegressor\"\n)\ndisplay.figure_.subplots_adjust(hspace=0.3)"
7373
]
7474
},
7575
{
@@ -105,7 +105,7 @@
105105
},
106106
"outputs": [],
107107
"source": [
108-
"print(\"Computing partial dependence plots...\")\ntic = time()\ndisplay = PartialDependenceDisplay.from_estimator(\n est,\n X_train,\n features,\n kind=\"both\",\n subsample=50,\n n_jobs=3,\n grid_resolution=20,\n random_state=0,\n ice_lines_kw={\"color\": \"tab:blue\", \"alpha\": 0.2, \"linewidth\": 0.5},\n pd_line_kw={\"color\": \"tab:orange\", \"linestyle\": \"--\"},\n)\nprint(f\"done in {time() - tic:.3f}s\")\ndisplay.figure_.suptitle(\n \"Partial dependence of house value on non-location features\\n\"\n \"for the California housing dataset, with Gradient Boosting\"\n)\ndisplay.figure_.subplots_adjust(wspace=0.4, hspace=0.3)"
108+
"print(\"Computing partial dependence plots...\")\ntic = time()\ndisplay = PartialDependenceDisplay.from_estimator(\n est,\n X_train,\n features=[\"MedInc\", \"AveOccup\", \"HouseAge\", \"AveRooms\"],\n kind=\"both\",\n **common_params,\n)\nprint(f\"done in {time() - tic:.3f}s\")\ndisplay.figure_.suptitle(\n \"Partial dependence of house value on non-location features\\n\"\n \"for the California housing dataset, with Gradient Boosting\"\n)\ndisplay.figure_.subplots_adjust(wspace=0.4, hspace=0.3)"
109109
]
110110
},
111111
{
@@ -130,7 +130,7 @@
130130
},
131131
"outputs": [],
132132
"source": [
133-
"features = [\"AveOccup\", \"HouseAge\", (\"AveOccup\", \"HouseAge\")]\nprint(\"Computing partial dependence plots...\")\ntic = time()\n_, ax = plt.subplots(ncols=3, figsize=(9, 4))\ndisplay = PartialDependenceDisplay.from_estimator(\n est,\n X_train,\n features,\n kind=\"average\",\n n_jobs=2,\n grid_resolution=10,\n ax=ax,\n)\nprint(f\"done in {time() - tic:.3f}s\")\ndisplay.figure_.suptitle(\n \"Partial dependence of house value on non-location features\\n\"\n \"for the California housing dataset, with Gradient Boosting\"\n)\ndisplay.figure_.subplots_adjust(wspace=0.4, hspace=0.3)"
133+
"import matplotlib.pyplot as plt\n\nprint(\"Computing partial dependence plots...\")\ntic = time()\n_, ax = plt.subplots(ncols=3, figsize=(9, 4))\n\n# Note that we could have called the method `from_estimator` three times and\n# provide one feature, one kind of plot, and one axis for each call.\ndisplay = PartialDependenceDisplay.from_estimator(\n est,\n X_train,\n features=[\"AveOccup\", \"HouseAge\", (\"AveOccup\", \"HouseAge\")],\n kind=[\"both\", \"both\", \"average\"],\n ax=ax,\n **common_params,\n)\n\nprint(f\"done in {time() - tic:.3f}s\")\ndisplay.figure_.suptitle(\n \"Partial dependence of house value on non-location features\\n\"\n \"for the California housing dataset, with Gradient Boosting\"\n)\ndisplay.figure_.subplots_adjust(wspace=0.4, hspace=0.3)"
134134
]
135135
},
136136
{
@@ -148,7 +148,7 @@
148148
},
149149
"outputs": [],
150150
"source": [
151-
"import numpy as np\nfrom mpl_toolkits.mplot3d import Axes3D\n\nfig = plt.figure()\n\nfeatures = (\"AveOccup\", \"HouseAge\")\npdp = partial_dependence(\n est, X_train, features=features, kind=\"average\", grid_resolution=10\n)\nXX, YY = np.meshgrid(pdp[\"values\"][0], pdp[\"values\"][1])\nZ = pdp.average[0].T\nax = Axes3D(fig)\nfig.add_axes(ax)\n\nsurf = ax.plot_surface(XX, YY, Z, rstride=1, cstride=1, cmap=plt.cm.BuPu, edgecolor=\"k\")\nax.set_xlabel(features[0])\nax.set_ylabel(features[1])\nax.set_zlabel(\"Partial dependence\")\n# pretty init view\nax.view_init(elev=22, azim=122)\nplt.colorbar(surf)\nplt.suptitle(\n \"Partial dependence of house value on median\\n\"\n \"age and average occupancy, with Gradient Boosting\"\n)\nplt.subplots_adjust(top=0.9)\nplt.show()"
151+
"import numpy as np\nfrom mpl_toolkits.mplot3d import Axes3D\nfrom sklearn.inspection import partial_dependence\n\nfig = plt.figure()\n\nfeatures = (\"AveOccup\", \"HouseAge\")\npdp = partial_dependence(\n est, X_train, features=features, kind=\"average\", grid_resolution=10\n)\nXX, YY = np.meshgrid(pdp[\"values\"][0], pdp[\"values\"][1])\nZ = pdp.average[0].T\nax = Axes3D(fig)\nfig.add_axes(ax)\n\nsurf = ax.plot_surface(XX, YY, Z, rstride=1, cstride=1, cmap=plt.cm.BuPu, edgecolor=\"k\")\nax.set_xlabel(features[0])\nax.set_ylabel(features[1])\nax.set_zlabel(\"Partial dependence\")\n# pretty init view\nax.view_init(elev=22, azim=122)\nplt.colorbar(surf)\nplt.suptitle(\n \"Partial dependence of house value on median\\n\"\n \"age and average occupancy, with Gradient Boosting\"\n)\nplt.subplots_adjust(top=0.9)\nplt.show()"
152152
]
153153
}
154154
],
Binary file not shown.

Diff for: dev/_downloads/bcd609cfe29c9da1f51c848e18b89c76/plot_partial_dependence.py

+15-23
Original file line numberDiff line numberDiff line change
@@ -111,24 +111,18 @@
111111
# We will plot the partial dependence, both individual (ICE) and averaged one
112112
# (PDP). We limit to only 50 ICE curves to not overcrowd the plot.
113113

114-
import matplotlib.pyplot as plt
115-
from sklearn.inspection import partial_dependence
116114
from sklearn.inspection import PartialDependenceDisplay
117115

116+
common_params = {"subsample": 50, "n_jobs": 2, "grid_resolution": 20, "random_state": 0}
117+
118118
print("Computing partial dependence plots...")
119119
tic = time()
120-
features = ["MedInc", "AveOccup", "HouseAge", "AveRooms"]
121120
display = PartialDependenceDisplay.from_estimator(
122121
est,
123122
X_train,
124-
features,
123+
features=["MedInc", "AveOccup", "HouseAge", "AveRooms"],
125124
kind="both",
126-
subsample=50,
127-
n_jobs=3,
128-
grid_resolution=20,
129-
random_state=0,
130-
ice_lines_kw={"color": "tab:blue", "alpha": 0.2, "linewidth": 0.5},
131-
pd_line_kw={"color": "tab:orange", "linestyle": "--"},
125+
**common_params,
132126
)
133127
print(f"done in {time() - tic:.3f}s")
134128
display.figure_.suptitle(
@@ -171,14 +165,9 @@
171165
display = PartialDependenceDisplay.from_estimator(
172166
est,
173167
X_train,
174-
features,
168+
features=["MedInc", "AveOccup", "HouseAge", "AveRooms"],
175169
kind="both",
176-
subsample=50,
177-
n_jobs=3,
178-
grid_resolution=20,
179-
random_state=0,
180-
ice_lines_kw={"color": "tab:blue", "alpha": 0.2, "linewidth": 0.5},
181-
pd_line_kw={"color": "tab:orange", "linestyle": "--"},
170+
**common_params,
182171
)
183172
print(f"done in {time() - tic:.3f}s")
184173
display.figure_.suptitle(
@@ -226,20 +215,23 @@
226215
# Another consideration is linked to the performance to compute the PDPs. With
227216
# the tree-based algorithm, when only PDPs are requested, they can be computed
228217
# on an efficient way using the `'recursion'` method.
218+
import matplotlib.pyplot as plt
229219

230-
features = ["AveOccup", "HouseAge", ("AveOccup", "HouseAge")]
231220
print("Computing partial dependence plots...")
232221
tic = time()
233222
_, ax = plt.subplots(ncols=3, figsize=(9, 4))
223+
224+
# Note that we could have called the method `from_estimator` three times and
225+
# provide one feature, one kind of plot, and one axis for each call.
234226
display = PartialDependenceDisplay.from_estimator(
235227
est,
236228
X_train,
237-
features,
238-
kind="average",
239-
n_jobs=2,
240-
grid_resolution=10,
229+
features=["AveOccup", "HouseAge", ("AveOccup", "HouseAge")],
230+
kind=["both", "both", "average"],
241231
ax=ax,
232+
**common_params,
242233
)
234+
243235
print(f"done in {time() - tic:.3f}s")
244236
display.figure_.suptitle(
245237
"Partial dependence of house value on non-location features\n"
@@ -260,9 +252,9 @@
260252
#
261253
# Let's make the same partial dependence plot for the 2 features interaction,
262254
# this time in 3 dimensions.
263-
264255
import numpy as np
265256
from mpl_toolkits.mplot3d import Axes3D
257+
from sklearn.inspection import partial_dependence
266258

267259
fig = plt.figure()
268260

Diff for: dev/_downloads/scikit-learn-docs.zip

50.1 KB
Binary file not shown.
-40 Bytes
209 Bytes
151 Bytes
-13 Bytes

Diff for: dev/_images/sphx_glr_plot_anomaly_comparison_001.png

-384 Bytes
-11 Bytes
3.45 KB
1.51 KB

Diff for: dev/_images/sphx_glr_plot_cluster_comparison_001.png

1.06 KB
-1 Bytes

Diff for: dev/_images/sphx_glr_plot_coin_segmentation_001.png

140 Bytes

Diff for: dev/_images/sphx_glr_plot_coin_segmentation_002.png

-75 Bytes

Diff for: dev/_images/sphx_glr_plot_coin_segmentation_003.png

-42 Bytes
53 Bytes
-64 Bytes
63 Bytes

Diff for: dev/_images/sphx_glr_plot_compare_methods_001.png

-359 Bytes

Diff for: dev/_images/sphx_glr_plot_compare_methods_thumb.png

73 Bytes

Diff for: dev/_images/sphx_glr_plot_dict_face_patches_001.png

94 Bytes
108 Bytes

Diff for: dev/_images/sphx_glr_plot_digits_pipe_001.png

-77 Bytes

Diff for: dev/_images/sphx_glr_plot_digits_pipe_thumb.png

-54 Bytes
56 Bytes
-94 Bytes
-2.51 KB
1.04 KB
-1022 Bytes
277 Bytes

Diff for: dev/_images/sphx_glr_plot_image_denoising_001.png

85 Bytes

Diff for: dev/_images/sphx_glr_plot_image_denoising_003.png

-157 Bytes

Diff for: dev/_images/sphx_glr_plot_image_denoising_005.png

-1 Bytes

Diff for: dev/_images/sphx_glr_plot_image_denoising_thumb.png

56 Bytes
-169 Bytes
182 Bytes
20 Bytes
1 KB
25 Bytes
89 Bytes

Diff for: dev/_images/sphx_glr_plot_learning_curve_001.png

-1.63 KB

Diff for: dev/_images/sphx_glr_plot_learning_curve_thumb.png

-117 Bytes

Diff for: dev/_images/sphx_glr_plot_linkage_comparison_001.png

-110 Bytes
3 Bytes

Diff for: dev/_images/sphx_glr_plot_lle_digits_004.png

-71 Bytes

Diff for: dev/_images/sphx_glr_plot_lle_digits_005.png

23 Bytes

Diff for: dev/_images/sphx_glr_plot_lle_digits_006.png

13 Bytes

Diff for: dev/_images/sphx_glr_plot_lle_digits_007.png

-24 Bytes

Diff for: dev/_images/sphx_glr_plot_lle_digits_008.png

-34 Bytes

Diff for: dev/_images/sphx_glr_plot_lle_digits_009.png

-11 Bytes

Diff for: dev/_images/sphx_glr_plot_lle_digits_010.png

-66 Bytes

Diff for: dev/_images/sphx_glr_plot_lle_digits_011.png

-46 Bytes

Diff for: dev/_images/sphx_glr_plot_lle_digits_012.png

93 Bytes

Diff for: dev/_images/sphx_glr_plot_lle_digits_013.png

68 Bytes

Diff for: dev/_images/sphx_glr_plot_lle_digits_014.png

41 Bytes

Diff for: dev/_images/sphx_glr_plot_manifold_sphere_001.png

84 Bytes

Diff for: dev/_images/sphx_glr_plot_manifold_sphere_thumb.png

147 Bytes
564 Bytes
-226 Bytes
-110 Bytes
362 Bytes
455 Bytes
-556 Bytes
44 Bytes

Diff for: dev/_images/sphx_glr_plot_partial_dependence_001.png

5.06 KB

Diff for: dev/_images/sphx_glr_plot_partial_dependence_002.png

4.56 KB

Diff for: dev/_images/sphx_glr_plot_partial_dependence_003.png

38.5 KB
2.3 KB

Diff for: dev/_images/sphx_glr_plot_prediction_latency_001.png

-625 Bytes

Diff for: dev/_images/sphx_glr_plot_prediction_latency_002.png

22 Bytes

Diff for: dev/_images/sphx_glr_plot_prediction_latency_003.png

-1.93 KB

Diff for: dev/_images/sphx_glr_plot_prediction_latency_004.png

15 Bytes
-403 Bytes
-223 Bytes
-443 Bytes
144 Bytes
209 Bytes

Diff for: dev/_images/sphx_glr_plot_sgd_early_stopping_001.png

-6.24 KB
-1.8 KB

Diff for: dev/_images/sphx_glr_plot_stack_predictors_001.png

-359 Bytes

Diff for: dev/_images/sphx_glr_plot_stack_predictors_thumb.png

-11 Bytes
863 Bytes
191 Bytes

Diff for: dev/_images/sphx_glr_plot_theilsen_001.png

-17 Bytes

Diff for: dev/_images/sphx_glr_plot_theilsen_002.png

2 Bytes

Diff for: dev/_images/sphx_glr_plot_theilsen_thumb.png

2 Bytes

Diff for: dev/_sources/auto_examples/applications/plot_cyclical_feature_engineering.rst.txt

+1-1

Diff for: dev/_sources/auto_examples/applications/plot_digits_denoising.rst.txt

+1-1

Diff for: dev/_sources/auto_examples/applications/plot_face_recognition.rst.txt

+5-5

Diff for: dev/_sources/auto_examples/applications/plot_model_complexity_influence.rst.txt

+15-15

0 commit comments

Comments
 (0)