code: def test_explanation_numerical_shapes(
      rf_classifier, iris_data, grid_resolution, features
  ):
      """Checks the correct shapes of the arrays contained in the explanation object of numerical features
      for the black-box implementation."""
      predictor, _ = rf_classifier
      X_train, y_train = (
          iris_data["X_train"][:30],
          iris_data["y_train"][:30],
      )
      num_targets = len(np.unique(y_train))
      num_instances = len(X_train)
  
      explainer = PartialDependence(predictor=predictor.predict_proba)
      exp = explainer.explain(
          X=X_train,
          features=features,
          grid_resolution=grid_resolution,
          kind="both",
      )
  
      # check that the values returned match the number of requested features
      assert len(exp.data["feature_names"]) == len(features)
      assert len(exp.data["pd_values"]) == len(features)
      assert len(exp.data["ice_values"]) == len(features)
      assert len(exp.data["feature_values"]) == len(features)
  
      for i, f in enumerate(features):
          if isinstance(f, Tuple):
              # check deciles
              assert isinstance(exp.data["feature_deciles"][i], List)
              assert len(exp.data["feature_deciles"][i]) == len(f)
              assert len(exp.data["feature_deciles"][i][0]) == 11
              assert len(exp.data["feature_deciles"][i][1]) == 11
  
              # check feature_values
              assert isinstance(exp.data["feature_values"][i], List)
              assert len(exp.data["feature_values"][i]) == len(f)
              assert len(exp.data["feature_values"][i][0]) == (
                  len(np.unique(X_train[:, f[0]]))
                  if grid_resolution == np.inf
                  else grid_resolution
              )
              assert len(exp.data["feature_values"][i][1]) == (
                  len(np.unique(X_train[:, f[1]]))
                  if grid_resolution == np.inf
                  else grid_resolution
              )
  
              # check pd_values
              assert exp.data["pd_values"][i].shape == (
                  num_targets,
                  len(exp.data["feature_values"][i][0]),
                  len(exp.data["feature_values"][i][1]),
              )
  
              # check ice_values
              assert exp.data["ice_values"][i].shape == (
                  num_targets,
                  num_instances,
                  len(exp.data["feature_values"][i][0]),
                  len(exp.data["feature_values"][i][1]),
              )
  
          else:
              # check feature_deciles
              assert len(exp.data["feature_deciles"][i]) == 11
  
              # check feature_values
              assert len(exp.data["feature_values"][i]) == (
                  len(np.unique(X_train[:, f]))
                  if grid_resolution == np.inf
                  else grid_resolution
              )
  
              # check pd_values
              assert exp.data["pd_values"][i].shape == (
                  num_targets,
                  len(exp.data["feature_values"][i]),
              )
  
              # check ice_value
              assert exp.data["ice_values"][i].shape == (
                  num_targets,
                  num_instances,
                  len(exp.data["feature_values"][i]),
              )
  
imports: import re
  import sys
  from copy import deepcopy
  from typing import Dict, List, Optional, Tuple, Union
  from packaging import version
  import matplotlib.pyplot
  import numpy
  import pandas
  import pytest
  from pytest_lazyfixture import lazy_fixture
  from sklearn.base import BaseEstimator
  from sklearn.datasets import make_classification
  from sklearn.ensemble import GradientBoostingClassifier
  from sklearn.exceptions import NotFittedError
  from sklearn.inspection import partial_dependence
  from sklearn.model_selection import train_test_split
  from sklearn.multioutput import MultiOutputClassifier
  from sklearn.pipeline import Pipeline
  from sklearn.utils import Bunch, shuffle
  import sklearn
  from alibi.api.defaults import DEFAULT_DATA_PD, DEFAULT_META_PD
  from alibi.api.interfaces import Explanation
  from alibi.explainers import PartialDependence, TreePartialDependence, plot_pd
  from alibi.explainers.partial_dependence import _plot_one_pd_cat, _plot_one_pd_num, _plot_two_pd_cat_cat, _plot_two_pd_num_cat, _plot_two_pd_num_num, _process_pd_ice, _sample_ice
label_desc: Use image node_id 8 for calling a global function with example usage: test_explanation_numerical_shapes(rf_classifier, iris_data, grid_resolution, features) without return types