code: def test_explanation_shapes(num_targets, num_features, method):
      """Tests whether the explanation shapes match the expectation."""
      explainer = PartialDependenceVariance(
          predictor=lambda x: np.empty((len(x), num_targets))
      )
      exp = explainer.explain(
          X=np.empty((10, num_features)), method=method
      )
      expected_num_features = (
          num_features
          if method == "importance"
          else num_features * (num_features - 1) // 2
      )
      assert len(exp.data["feature_deciles"]) == expected_num_features
      assert len(exp.data["feature_values"]) == expected_num_features
      assert len(exp.data["feature_names"]) == expected_num_features
      assert len(exp.data["pd_values"]) == expected_num_features
      assert np.all(
          pd_values.shape[0] == num_targets
          for pd_values in exp.data["pd_values"]
      )
  
      if method == "importance":
          assert exp.data["feature_importance"].shape == (
              num_targets,
              expected_num_features,
          )
      else:
          assert exp.data["feature_interaction"].shape == (
              num_targets,
              expected_num_features,
          )
          assert (
              len(exp.data["conditional_importance"])
              == expected_num_features
          )
          assert (
              len(exp.data["conditional_importance"])
              == expected_num_features
          )
  
imports: import re
  from copy import deepcopy
  import matplotlib.pyplot
  import numpy
  import pandas
  import pytest
  from pytest_lazyfixture import lazy_fixture
  from sklearn.ensemble import GradientBoostingRegressor
  from sklearn.linear_model import LinearRegression
  from alibi.api.defaults import DEFAULT_DATA_PDVARIANCE, DEFAULT_META_PDVARIANCE
  from alibi.api.interfaces import Explanation
  from alibi.explainers import PartialDependence, PartialDependenceVariance, TreePartialDependence
  from alibi.explainers.pd_variance import _plot_feature_importance, _plot_feature_interaction, _plot_hbar, plot_pd_variance
label_desc: Use image node_id 5 for calling a global function with example usage: test_explanation_shapes(num_targets, num_features, method) without return types