code: def _grid_from_X(X, percentiles=(0.05, 0.95), grid_resolution=100):
      """Generate a grid of points based on the ``percentiles of ``X``.
  
      The grid is generated by placing ``grid_resolution`` equally
      spaced points between the ``percentiles`` of each column
      of ``X``.
  
      Parameters
      ----------
      X : ndarray
          The data
      percentiles : tuple of floats
          The percentiles which are used to construct the extreme
          values of the grid axes.
      grid_resolution : int
          The number of equally spaced points that are placed
          on the grid.
  
      Returns
      -------
      grid : ndarray
          All data points on the grid; ``grid.shape[1] == X.shape[1]``
          and ``grid.shape[0] == grid_resolution * X.shape[1]``.
      axes : seq of ndarray
          The axes with which the grid has been created.
      """
      if len(percentiles) != 2:
          raise ValueError("percentile must be tuple of len 2")
      if not all(0.0 <= x <= 1.0 for x in percentiles):
          raise ValueError("percentile values must be in [0, 1]")
  
      axes = []
      for col in range(X.shape[1]):
          uniques = np.unique(X[:, col])
          if uniques.shape[0] < grid_resolution:
              # feature has low resolution use unique vals
              axis = uniques
          else:
              emp_percentiles = mquantiles(X, prob=percentiles, axis=0)
              # create axis based on percentiles and grid resolution
              axis = np.linspace(
                  emp_percentiles[0, col],
                  emp_percentiles[1, col],
                  num=grid_resolution,
                  endpoint=True,
              )
          axes.append(axis)
  
      return cartesian(axes), axes
  
file_path: catboost/contrib/python/scikit-learn/py2/sklearn/ensemble/partial_dependence.py
imports: from itertools import count
  import numbers
  import numpy
  from scipy.stats.mstats import mquantiles
  from ..utils.extmath import cartesian
  from ..externals.joblib import Parallel, delayed
  from ..externals import six
  from ..externals.six.moves import map, range, zip
  from ..utils import check_array
  from ..tree._tree import DTYPE
  from ._gradient_boosting import _partial_dependence_tree
  from .gradient_boosting import BaseGradientBoosting
label_desc: Use image node_id 1 for calling a global function with example usage: _grid_from_X(X, percentiles, grid_resolution) and returns: cartesian,  axes