code: def _gen_pdp(
      X,
      predict_fn,
      col_idx,
      feature_type,
      num_points=10,
      std_coef=1.0,
      num_ice_samples=10,
  ):
      num_uniq_vals = len(np.unique(X[:, col_idx]))
      if (
          feature_type == "nominal"
          or feature_type == "ordinal"
          or num_uniq_vals <= num_points
      ):
          grid_points = _unique_grid_points(X[:, col_idx])
          values, counts = np.unique(X[:, col_idx], return_counts=True)
      else:
          grid_points = _percentile_grid_points(
              X[:, col_idx], num_points=num_points
          )
          counts, values = np.histogram(X[:, col_idx], bins="doane")
  
      X_mut = X.copy()
      ice_lines = np.zeros((X.shape[0], grid_points.shape[0]))
      for idx, grid_point in enumerate(grid_points):
          X_mut[:, col_idx] = grid_point
          ice_lines[:, idx] = predict_fn(X_mut)
      mean = np.mean(ice_lines, axis=0)
      std = np.std(ice_lines, axis=0)
  
      ice_lines = ice_lines[
          np.random.choice(
              ice_lines.shape[0], num_ice_samples, replace=False
          ),
          :,
      ]
  
      return {
          "type": "univariate",
          "names": grid_points,
          "scores": mean,
          # TODO: can we get rid of this column of X?
          "values": X[:, col_idx],
          "density": {"names": values, "scores": counts},
          # NOTE: We can take either bounds or background values, picked one.
          "upper_bounds": mean + std * std_coef,
          "lower_bounds": mean - std * std_coef,
          "background_scores": ice_lines,
      }
  
file_path: interpret/python/interpret-core/interpret/blackbox/_partialdependence.py
imports: from ..api.base import ExplainerMixin, ExplanationMixin
  import numpy
  from ..utils._explanation import gen_name_from_class, gen_global_selector
  from ..utils._clean_x import preclean_X
  from ..utils._unify_predict import determine_classes, unify_predict_fn
  from ..utils._unify_data import unify_data
label_desc: Use image node_id 3 for calling a global function with example usage: _gen_pdp(X, predict_fn, col_idx, feature_type, num_points, std_coef, num_ice_samples) and returns: dict