@@ -55,20 +55,20 @@ independent of the house age, whereas for values less than 2 there is a strong
55
55
dependence on age.
56
56
57
57
The :mod: `sklearn.inspection ` module provides a convenience function
58
- :func: `plot_partial_dependence ` to create one-way and two-way partial
58
+ :func: `~PartialDependenceDisplay.from_estimator ` to create one-way and two-way partial
59
59
dependence plots. In the below example we show how to create a grid of
60
60
partial dependence plots: two one-way PDPs for the features ``0 `` and ``1 ``
61
61
and a two-way PDP between the two features::
62
62
63
63
>>> from sklearn.datasets import make_hastie_10_2
64
64
>>> from sklearn.ensemble import GradientBoostingClassifier
65
- >>> from sklearn.inspection import plot_partial_dependence
65
+ >>> from sklearn.inspection import PartialDependenceDisplay
66
66
67
67
>>> X, y = make_hastie_10_2(random_state=0)
68
68
>>> clf = GradientBoostingClassifier(n_estimators=100, learning_rate=1.0,
69
69
... max_depth=1, random_state=0).fit(X, y)
70
70
>>> features = [0, 1, (0, 1)]
71
- >>> plot_partial_dependence (clf, X, features)
71
+ >>> PartialDependenceDisplay.from_estimator (clf, X, features)
72
72
<...>
73
73
74
74
You can access the newly created figure and Axes objects using ``plt.gcf() ``
@@ -82,7 +82,7 @@ the PDPs should be created via the ``target`` argument::
82
82
>>> mc_clf = GradientBoostingClassifier(n_estimators=10,
83
83
... max_depth=1).fit(iris.data, iris.target)
84
84
>>> features = [3, 2, (3, 2)]
85
- >>> plot_partial_dependence (mc_clf, X, features, target=0)
85
+ >>> PartialDependenceDisplay.from_estimator (mc_clf, X, features, target=0)
86
86
<...>
87
87
88
88
The same parameter ``target `` is used to specify the target in multi-output
@@ -138,20 +138,20 @@ and the house price in the PD line. However, the ICE lines show that there
138
138
are some exceptions, where the house price remains constant in some ranges of
139
139
the median income.
140
140
141
- The :mod: `sklearn.inspection ` module's :func: ` plot_partial_dependence `
141
+ The :mod: `sklearn.inspection ` module's :meth: ` PartialDependenceDisplay.from_estimator `
142
142
convenience function can be used to create ICE plots by setting
143
143
``kind='individual' ``. In the example below, we show how to create a grid of
144
144
ICE plots:
145
145
146
146
>>> from sklearn.datasets import make_hastie_10_2
147
147
>>> from sklearn.ensemble import GradientBoostingClassifier
148
- >>> from sklearn.inspection import plot_partial_dependence
148
+ >>> from sklearn.inspection import PartialDependenceDisplay
149
149
150
150
>>> X, y = make_hastie_10_2(random_state = 0 )
151
151
>>> clf = GradientBoostingClassifier(n_estimators = 100 , learning_rate = 1.0 ,
152
152
... max_depth= 1 , random_state= 0 ).fit(X, y)
153
153
>>> features = [0 , 1 ]
154
- >>> plot_partial_dependence (clf, X, features,
154
+ >>> PartialDependenceDisplay.from_estimator (clf, X, features,
155
155
... kind= ' individual' )
156
156
<...>
157
157
@@ -160,7 +160,7 @@ feature of interest. Hence, it is recommended to use ICE plots alongside
160
160
PDPs. They can be plotted together with
161
161
``kind='both' ``.
162
162
163
- >>> plot_partial_dependence (clf, X, features,
163
+ >>> PartialDependenceDisplay.from_estimator (clf, X, features,
164
164
... kind= ' both' )
165
165
<...>
166
166
0 commit comments