code: def test_output_shape(
      Estimator, method, data, grid_resolution, features, kind
  ):
      # Check that partial_dependence has consistent output shape for different
      # kinds of estimators:
      # - classifiers with binary and multiclass settings
      # - regressors
      # - multi-task regressors
  
      est = Estimator()
      if hasattr(est, "n_estimators"):
          est.set_params(n_estimators=2)  # speed-up computations
  
      # n_target corresponds to the number of classes (1 for binary classif) or
      # the number of tasks / outputs in multi task settings. It's equal to 1 for
      # classical regression_data.
      (X, y), n_targets = data
      n_instances = X.shape[0]
  
      est.fit(X, y)
      result = partial_dependence(
          est,
          X=X,
          features=features,
          method=method,
          kind=kind,
          grid_resolution=grid_resolution,
      )
      pdp, axes = result, result["grid_values"]
  
      expected_pdp_shape = (
          n_targets,
          *[grid_resolution for _ in range(len(features))],
      )
      expected_ice_shape = (
          n_targets,
          n_instances,
          *[grid_resolution for _ in range(len(features))],
      )
      if kind == "average":
          assert pdp.average.shape == expected_pdp_shape
      elif kind == "individual":
          assert pdp.individual.shape == expected_ice_shape
      else:  # 'both'
          assert pdp.average.shape == expected_pdp_shape
          assert pdp.individual.shape == expected_ice_shape
  
      expected_axes_shape = (len(features), grid_resolution)
      assert axes is not None
      assert np.asarray(axes).shape == expected_axes_shape
  
imports: import warnings
  import numpy
  import pytest
  import sklearn
  from sklearn.base import BaseEstimator, ClassifierMixin, clone, is_regressor
  from sklearn.cluster import KMeans
  from sklearn.compose import make_column_transformer
  from sklearn.datasets import load_iris, make_classification, make_regression
  from sklearn.dummy import DummyClassifier
  from sklearn.ensemble import GradientBoostingClassifier, GradientBoostingRegressor, HistGradientBoostingClassifier, HistGradientBoostingRegressor, RandomForestRegressor
  from sklearn.exceptions import NotFittedError
  from sklearn.inspection import partial_dependence
  from sklearn.inspection._partial_dependence import _grid_from_X, _partial_dependence_brute, _partial_dependence_recursion
  from sklearn.linear_model import LinearRegression, LogisticRegression, MultiTaskLasso
  from sklearn.metrics import r2_score
  from sklearn.pipeline import make_pipeline
  from sklearn.preprocessing import PolynomialFeatures, RobustScaler, StandardScaler, scale
  from sklearn.tree import DecisionTreeRegressor
  from sklearn.tree.tests.test_tree import assert_is_subtree
  from sklearn.utils import _IS_32BIT
  from sklearn.utils._testing import assert_allclose, assert_array_equal
  from sklearn.utils.validation import check_random_state
label_desc: Use image node_id 1 for calling a global function with example usage: test_output_shape(Estimator, method, data, grid_resolution, features, kind) without return types