Skip to content

Commit defa034

Browse files
committed
Pushing the docs to dev/ for branch: main, commit adb47e7c142ce6d699cc5927925d448cb2c1ab91
1 parent 5681c77 commit defa034

File tree

1,238 files changed

+4606
-4497
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,238 files changed

+4606
-4497
lines changed
Binary file not shown.

dev/_downloads/21b82d82985712b5de6347f382c77c86/plot_partial_dependence.ipynb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@
6969
},
7070
"outputs": [],
7171
"source": [
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)"
72+
"from sklearn.inspection import PartialDependenceDisplay\n\ncommon_params = {\n \"subsample\": 50,\n \"n_jobs\": 2,\n \"grid_resolution\": 20,\n \"centered\": True,\n \"random_state\": 0,\n}\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
{
@@ -112,7 +112,7 @@
112112
"cell_type": "markdown",
113113
"metadata": {},
114114
"source": [
115-
"### Analysis of the plots\n\nWe can clearly see on the PDPs (dashed orange line) that the median house price\nshows a linear relationship with the median income (top left) and that the\nhouse price drops when the average occupants per household increases (top\nmiddle). The top right plot shows that the house age in a district does not\nhave a strong influence on the (median) house price; so does the average\nrooms per household.\n\nThe ICE curves (light blue lines) complement the analysis: we can see that\nthere are some exceptions, where the house price remain constant with median\nincome and average occupants. On the other hand, while the house age (top\nright) does not have a strong influence on the median house price on average,\nthere seems to be a number of exceptions where the house price increase when\nbetween the ages 15-25. Similar exceptions can be observed for the average\nnumber of rooms (bottom left). Therefore, ICE plots show some individual\neffect which are attenuated by taking the averages.\n\nIn all plots, the tick marks on the x-axis represent the deciles of the\nfeature values in the training data.\n\nWe also observe that :class:`~sklearn.neural_network.MLPRegressor` has much\nsmoother predictions than\n:class:`~sklearn.ensemble.HistGradientBoostingRegressor`.\n\nHowever, it is worth noting that we are creating potential meaningless\nsynthetic samples if features are correlated.\n\n"
115+
"### Analysis of the plots\n\nWe can clearly see on the PDPs (dashed orange line) that the median house price\nshows a linear relationship with the median income (top left) and that the\nhouse price drops when the average occupants per household increases (top\nmiddle). The top right plot shows that the house age in a district does not\nhave a strong influence on the (median) house price; so does the average\nrooms per household.\n\nThe ICE curves (light blue lines) complement the analysis: we can see that\nthere are some exceptions (which are better highlighted with the option\n`centered=True`), where the house price remains constant with respect to\nmedian income and average occupants variations.\nOn the other hand, while the house age (top right) does not have a strong\ninfluence on the median house price on average, there seems to be a number\nof exceptions where the house price increases when\nbetween the ages 15-25. Similar exceptions can be observed for the average\nnumber of rooms (bottom left). Therefore, ICE plots show some individual\neffect which are attenuated by taking the averages.\n\nIn all plots, the tick marks on the x-axis represent the deciles of the\nfeature values in the training data.\n\nWe also observe that :class:`~sklearn.neural_network.MLPRegressor` has much\nsmoother predictions than\n:class:`~sklearn.ensemble.HistGradientBoostingRegressor`.\n\nHowever, it is worth noting that we are creating potential meaningless\nsynthetic samples if features are correlated.\n\n"
116116
]
117117
},
118118
{
Binary file not shown.

dev/_downloads/bcd609cfe29c9da1f51c848e18b89c76/plot_partial_dependence.py

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,13 @@
113113

114114
from sklearn.inspection import PartialDependenceDisplay
115115

116-
common_params = {"subsample": 50, "n_jobs": 2, "grid_resolution": 20, "random_state": 0}
116+
common_params = {
117+
"subsample": 50,
118+
"n_jobs": 2,
119+
"grid_resolution": 20,
120+
"centered": True,
121+
"random_state": 0,
122+
}
117123

118124
print("Computing partial dependence plots...")
119125
tic = time()
@@ -188,10 +194,12 @@
188194
# rooms per household.
189195
#
190196
# The ICE curves (light blue lines) complement the analysis: we can see that
191-
# there are some exceptions, where the house price remain constant with median
192-
# income and average occupants. On the other hand, while the house age (top
193-
# right) does not have a strong influence on the median house price on average,
194-
# there seems to be a number of exceptions where the house price increase when
197+
# there are some exceptions (which are better highlighted with the option
198+
# `centered=True`), where the house price remains constant with respect to
199+
# median income and average occupants variations.
200+
# On the other hand, while the house age (top right) does not have a strong
201+
# influence on the median house price on average, there seems to be a number
202+
# of exceptions where the house price increases when
195203
# between the ages 15-25. Similar exceptions can be observed for the average
196204
# number of rooms (bottom left). Therefore, ICE plots show some individual
197205
# effect which are attenuated by taking the averages.

dev/_downloads/scikit-learn-docs.zip

-50 KB
Binary file not shown.
258 Bytes
215 Bytes
-110 Bytes
-93 Bytes
75 Bytes

0 commit comments

Comments
 (0)