code: def test_partial_dependence_sample_weight_of_fitted_estimator():
      # Test near perfect correlation between partial dependence and diagonal
      # when sample weights emphasize y = x predictions
      # non-regression test for #13193
      # TODO: extend to HistGradientBoosting once sample_weight is supported
      N = 1000
      rng = np.random.RandomState(123456)
      mask = rng.randint(2, size=N, dtype=bool)
  
      x = rng.rand(N)
      # set y = x on mask and y = -x outside
      y = x.copy()
      y[~mask] = -y[~mask]
      X = np.c_[mask, x]
      # sample weights to emphasize data points where y = x
      sample_weight = np.ones(N)
      sample_weight[mask] = 1000.0
  
      clf = GradientBoostingRegressor(n_estimators=10, random_state=1)
      clf.fit(X, y, sample_weight=sample_weight)
  
      pdp = partial_dependence(clf, X, features=[1], kind="average")
  
      assert (
          np.corrcoef(pdp["average"], pdp["grid_values"])[0, 1] > 0.99
      )
  
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 16 for calling a global function with example usage: test_partial_dependence_sample_weight_of_fitted_estimator() without return types