class_docstr: Black-box implementation of partial dependence for tabular datasets.
  Supports multiple feature interactions. 
class_docstr_tok: ["Black-box","implementation","of","partial","dependence","for","tabular","datasets",".","Supports","multiple","feature","interactions","."]
docstr: Computes the partial dependence using the brute method. Code borrowed from:
  https://github.com/scikit-learn/scikit-learn/blob/baf0ea25d/sklearn/inspection/_partial_dependence.py
  
  Parameters
  --------
  grid
      Cartesian product between feature values. Covers also the case of a single feature.
  features
      Feature column indices.
  X
       See :py:meth:`alibi.explainers.partial_dependence.PartialDependence.explain` method.
  
  Returns
  -------
  Partial dependence for the given features.
docstr_tok: ["Computes","the","partial","dependence","using","the","brute","method",".","Code","borrowed","from",":","https",":","\/\/github.com\/scikit-learn\/scikit-learn\/blob\/baf0ea25d\/sklearn\/inspection\/_partial_dependence.py","Parameters","--","--","--","--","grid","Cartesian","product","between","feature","values",".","Covers","also","the","case","of","a","single","feature",".","features","Feature","column","indices",".","X","See",":","py",":","meth",":","`","alibi.explainers.partial_dependence.PartialDependence.explain","`","method",".","Returns","--","--","--","-","Partial","dependence","for","the","given","features","."]
code: def _compute_pd(
      self, grid: np.ndarray, features: np.ndarray, X: np.ndarray
  ) -> Tuple[np.ndarray, Optional[np.ndarray]]:
      """
      Computes the partial dependence using the brute method. Code borrowed from:
      https://github.com/scikit-learn/scikit-learn/blob/baf0ea25d/sklearn/inspection/_partial_dependence.py
  
      Parameters
      --------
      grid
          Cartesian product between feature values. Covers also the case of a single feature.
      features
          Feature column indices.
      X
           See :py:meth:`alibi.explainers.partial_dependence.PartialDependence.explain` method.
  
      Returns
      -------
      Partial dependence for the given features.
      """
      predictions = []
      averaged_predictions = []
      X_eval = X.copy()
  
      for grid_values in grid:
          X_eval[:, features] = grid_values
  
          # Note: predictions is of shape
          # (n_points,) for non-multioutput regressors
          # (n_points, n_tasks) for multioutput regressors
          # (n_points, 1) for the regressors in cross_decomposition (I think)
          # (n_points, 2) for binary classification
          # (n_points, n_classes) for multiclass classification
          pred = self.predictor(X_eval)
          predictions.append(pred)
  
          # average over samples
          averaged_predictions.append(np.mean(pred, axis=0))
  
      # cast to `np.ndarray` and transpose
      predictions = np.array(predictions).T  # type: ignore[assignment]
      averaged_predictions = np.array(averaged_predictions).T  # type: ignore[assignment]
      return averaged_predictions, predictions
  
imports: import copy
  import logging
  import math
  import numbers
  import sys
  from abc import ABC, abstractmethod
  from enum import Enum
  from typing import Callable, Dict, Iterable, List, Optional, Tuple, Union, no_type_check
  import matplotlib.pyplot
  import numpy
  from scipy.stats.mstats import mquantiles
  from sklearn.base import BaseEstimator, is_classifier, is_regressor
  from sklearn.ensemble import RandomForestRegressor
  from sklearn.ensemble._gb import BaseGradientBoosting
  from sklearn.ensemble._hist_gradient_boosting.gradient_boosting import BaseHistGradientBoosting
  from sklearn.tree import DecisionTreeRegressor
  from sklearn.utils.extmath import cartesian
  from sklearn.utils.validation import check_is_fitted
  from tqdm import tqdm
  from alibi.api.defaults import DEFAULT_DATA_PD, DEFAULT_META_PD
  from alibi.api.interfaces import Explainer, Explanation
  from alibi.explainers.ale import get_quantiles
  from alibi.utils import _get_options_string
label_desc: Use image node_id 3 for calling the PartialDependence obj's underlying member method code with example usage: obj._compute_pd(grid, features, X) and returns: averaged_predictions,  predictions