docstr: Generate a grid of points based on the percentiles of `X`. If `grid_resolution` is bigger than the number
  of unique values in the jth column of `X`, then those unique values will be used instead.
  Code borrowed from:
  https://github.com/scikit-learn/scikit-learn/blob/baf0ea25d/sklearn/inspection/_partial_dependence.py
  
  Parameters
  ----------
  X
      Array to generate the grid for.
  percentiles
      The percentiles which are used to construct the extreme values of the grid. Must be in [0, 1].
  grid_resolution
      The number of equally spaced points to be placed on the grid for each feature.
  
  Returns
  -------
  The values with which the grid has been created. The size of each array `values[j]` is either
  `grid_resolution`, or the number of unique values in `X[:, j]`, whichever is smaller.
docstr_tok: ["Generate","a","grid","of","points","based","on","the","percentiles","of","`","X","`",".","If","`","grid_resolution","`","is","bigger","than","the","number","of","unique","values","in","the","jth","column","of","`","X","`",",","then","those","unique","values","will","be","used","instead",".","Code","borrowed","from",":","https",":","\/\/github.com\/scikit-learn\/scikit-learn\/blob\/baf0ea25d\/sklearn\/inspection\/_partial_dependence.py","Parameters","--","--","--","--","--","X","Array","to","generate","the","grid","for",".","percentiles","The","percentiles","which","are","used","to","construct","the","extreme","values","of","the","grid",".","Must","be","in","[","0",",","1","]",".","grid_resolution","The","number","of","equally","spaced","points","to","be","placed","on","the","grid","for","each","feature",".","Returns","--","--","--","-","The","values","with","which","the","grid","has","been","created",".","The","size","of","each","array","`","values","[","j","]","`","is","either","`","grid_resolution","`",",","or","the","number","of","unique","values","in","`","X","[",":",",","j","]","`",",","whichever","is","smaller","."]
code: def _grid_from_X(
      self,
      X: np.ndarray,
      percentiles: Tuple[float, float],
      grid_resolution: int,
  ):
      """
      Generate a grid of points based on the percentiles of `X`. If `grid_resolution` is bigger than the number
      of unique values in the jth column of `X`, then those unique values will be used instead.
      Code borrowed from:
      https://github.com/scikit-learn/scikit-learn/blob/baf0ea25d/sklearn/inspection/_partial_dependence.py
  
      Parameters
      ----------
      X
          Array to generate the grid for.
      percentiles
          The percentiles which are used to construct the extreme values of the grid. Must be in [0, 1].
      grid_resolution
          The number of equally spaced points to be placed on the grid for each feature.
  
      Returns
      -------
      The values with which the grid has been created. The size of each array `values[j]` is either
      `grid_resolution`, or the number of unique values in `X[:, j]`, whichever is smaller.
      """
      if not isinstance(percentiles, Iterable) or len(percentiles) != 2:
          raise ValueError(
              "`percentiles` must be a sequence of 2 elements."
          )
  
      if not all(0 <= x <= 1 for x in percentiles):  # type: ignore[attr-defined]
          raise ValueError("`percentiles` values must be in [0, 1].")
  
      if percentiles[0] >= percentiles[1]:  # type: ignore[index]
          raise ValueError(
              "`percentiles[0]` must be strictly less than `percentiles[1]`."
          )
  
      if grid_resolution <= 1:
          raise ValueError(
              "`grid_resolution` must be strictly greater than 1."
          )
  
      values = []
      for feature in range(X.shape[1]):
          uniques = np.unique(X[:, feature])
  
          if uniques.shape[0] < grid_resolution:
              # feature has low resolution use unique vals
              axis = uniques
          else:
              # create axis based on percentiles and grid resolution
              emp_percentiles = mquantiles(
                  X[:, feature], prob=percentiles, axis=0
              ).data
  
              if np.allclose(emp_percentiles[0], emp_percentiles[1]):
                  raise ValueError(
                      "`percentiles` are too close to each other, unable to build the grid. "
                      "Please choose percentiles that are further apart."
                  )
  
              # construct equidistant grid points
              axis = np.linspace(
                  emp_percentiles[0],
                  emp_percentiles[1],
                  num=grid_resolution,
                  endpoint=True,
              )
  
          values.append(axis)
      return values
  
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 7 for calling the PartialDependenceBase obj's underlying member method code with example usage: obj._grid_from_X(X, percentiles, grid_resolution) and returns: values