package sklearn

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type
type t
val of_pyobject : Py.Object.t -> t
val to_pyobject : t -> Py.Object.t
val create : pd_results:Py.Object.t -> features:Py.Object.t -> feature_names:string list -> target_idx:int -> pdp_lim:Dict.t -> deciles:Dict.t -> unit -> t

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_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 corresponds to a nonexisting axes in that position.

lines_ : ndarray of matplotlib Artists If `ax` is an axes or None, `line_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 corresponds to a nonexisting axes or an axes that does not include a line plot.

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 corresponds to a nonexisting axes or an axes that does not include a contour plot.

figure_ : matplotlib Figure Figure containing partial dependence plots.

val plot : ?ax:Py.Object.t -> ?n_cols:int -> ?line_kw:Dict.t -> ?contour_kw:Dict.t -> t -> Py.Object.t

Plot partial dependence plots.

Parameters ---------- ax : Matplotlib axes or array-like of Matplotlib axes, default=None

  • If a single axis is passed in, it is treated as a bounding axes and a grid of partial dependence plots will be drawn within these bounds. The `n_cols` parameter controls the number of columns in the grid.
  • If an array-like of axes are passed in, the partial dependence plots will be drawn directly into these axes.
  • If `None`, a figure and a bounding axes is created and treated as the single axes case.

n_cols : int, default=3 The maximum number of columns in the grid plot. Only active when `ax` is a single axes or `None`.

line_kw : dict, default=None Dict with keywords passed to the `matplotlib.pyplot.plot` call. For one-way partial dependence plots.

contour_kw : dict, default=None Dict with keywords passed to the `matplotlib.pyplot.contourf` call for two-way partial dependence plots.

Returns ------- display: :class:`~sklearn.inspection.PartialDependenceDisplay`

val bounding_ax_ : t -> Py.Object.t

Attribute bounding_ax_: get value or raise Not_found if None.

val bounding_ax_opt : t -> Py.Object.t option

Attribute bounding_ax_: get value as an option.

val axes_ : t -> Py.Object.t

Attribute axes_: get value or raise Not_found if None.

val axes_opt : t -> Py.Object.t option

Attribute axes_: get value as an option.

val lines_ : t -> Py.Object.t

Attribute lines_: get value or raise Not_found if None.

val lines_opt : t -> Py.Object.t option

Attribute lines_: get value as an option.

val contours_ : t -> Py.Object.t

Attribute contours_: get value or raise Not_found if None.

val contours_opt : t -> Py.Object.t option

Attribute contours_: get value as an option.

val figure_ : t -> Py.Object.t

Attribute figure_: get value or raise Not_found if None.

val figure_opt : t -> Py.Object.t option

Attribute figure_: get value as an option.

val to_string : t -> string

Print the object to a human-readable representation.

val show : t -> string

Print the object to a human-readable representation.

val pp : Format.formatter -> t -> unit

Pretty-print the object to a formatter.

OCaml

Innovation. Community. Security.