evalml.model_understanding.graph_partial_dependence

evalml.model_understanding.graph_partial_dependence(pipeline, X, features, class_label=None, grid_resolution=100)[source]

Create an one-way or two-way partial dependence plot. Passing a single integer or string as features will create a one-way partial dependence plot with the feature values plotted against the partial dependence. Passing features a tuple of int/strings will create a two-way partial dependence plot with a contour of feature[0] in the y-axis, feature[1] in the x-axis and the partial dependence in the z-axis.

Parameters
  • pipeline (PipelineBase or subclass) – Fitted pipeline

  • X (ww.DataTable, pd.DataFrame, np.ndarray) – The input data used to generate a grid of values for feature where partial dependence will be calculated at

  • features (int, string, tuple[int or string]) – The target feature for which to create the partial dependence plot for. If features is an int, it must be the index of the feature to use. If features is a string, it must be a valid column name in X. If features is a tuple of strings, it must contain valid column int/names in X.

  • class_label (string, optional) – Name of class to plot for multiclass problems. If None, will plot the partial dependence for each class. This argument does not change behavior for regression or binary classification pipelines. For binary classification, the partial dependence for the positive label will always be displayed. Defaults to None.

  • grid_resolution (int) – Number of samples of feature(s) for partial dependence plot

Returns

figure object containing the partial dependence data for plotting

Return type

plotly.graph_objects.Figure

Raises

ValueError – if a graph is requested for a class name that isn’t present in the pipeline