Partial Dependence Plot (PDP) visualization.
It is recommended to use :func:`~sklearn.inspection.plot_partial_dependence` to create a :class:`~sklearn.inspection.PartialDependenceDisplay`. All parameters are stored as attributes.
Read more in :ref:`sphx_glr_auto_examples_miscellaneous_plot_partial_dependence_visualization_api.py` and the :ref:`User Guide <visualizations>`.
.. versionadded:: 0.22
Parameters ---------- pd_results : list of (ndarray, ndarray) Results of :func:`~sklearn.inspection.partial_dependence` for ``features``. Each tuple corresponds to a (averaged_predictions, grid).
features : list of (int,) or list of (int, int) Indices of features for a given plot. A tuple of one integer will plot a partial dependence curve of one feature. A tuple of two integers will plot a two-way partial dependence curve as a contour plot.
feature_names : list of str Feature names corresponding to the indices in ``features``.
target_idx : int
- In a multiclass setting, specifies the class for which the PDPs should be computed. Note that for binary classification, the positive class (index 1) is always used.
- In a multioutput setting, specifies the task for which the PDPs should be computed.
Ignored in binary classification or classical regression settings.
pdp_lim : dict Global min and max average predictions, such that all plots will have the same scale and y limits. `pdp_lim1
` is the global min and max for single partial dependence curves. `pdp_lim2
` is the global min and max for two-way partial dependence curves.
deciles : dict Deciles for feature indices in ``features``.
Attributes ---------- bounding_ax_ : matplotlib Axes or None If `ax` is an axes or None, the `bounding_ax_` is the axes where the grid of partial dependence plots are drawn. If `ax` is a list of axes or a numpy array of axes, `bounding_ax_` is None.
axes_ : ndarray of matplotlib Axes If `ax` is an axes or None, `axes_i, j
` is the axes on the i-th row and j-th column. If `ax` is a list of axes, `axes_i
` is the i-th item in `ax`. Elements that are None correspond to a nonexisting axes in that position.
lines_ : ndarray of matplotlib Artists If `ax` is an axes or None, `lines_i, j
` is the partial dependence curve on the i-th row and j-th column. If `ax` is a list of axes, `lines_i
` is the partial dependence curve corresponding to the i-th item in `ax`. Elements that are None correspond to a nonexisting axes or an axes that does not include a line plot.
deciles_vlines_ : ndarray of matplotlib LineCollection If `ax` is an axes or None, `vlines_i, j
` is the line collection representing the x axis deciles of the i-th row and j-th column. If `ax` is a list of axes, `vlines_i
` corresponds to the i-th item in `ax`. Elements that are None correspond to a nonexisting axes or an axes that does not include a PDP plot. .. versionadded:: 0.23 deciles_hlines_ : ndarray of matplotlib LineCollection If `ax` is an axes or None, `vlines_i, j
` is the line collection representing the y axis deciles of the i-th row and j-th column. If `ax` is a list of axes, `vlines_i
` corresponds to the i-th item in `ax`. Elements that are None correspond to a nonexisting axes or an axes that does not include a 2-way plot. .. versionadded:: 0.23
contours_ : ndarray of matplotlib Artists If `ax` is an axes or None, `contours_i, j
` is the partial dependence plot on the i-th row and j-th column. If `ax` is a list of axes, `contours_i
` is the partial dependence plot corresponding to the i-th item in `ax`. Elements that are None correspond to a nonexisting axes or an axes that does not include a contour plot.
figure_ : matplotlib Figure Figure containing partial dependence plots.