code: def test_rescale_data_dense(setup, n_targets):
      n_samples = 200
      n_features = 2
  
      sample_weight = 1.0 + rng.rand(n_samples)
      X = rng.rand(n_samples, n_features)
      if n_targets is None:
          y = rng.rand(n_samples)
      else:
          y = rng.rand(n_samples, n_targets)
      rescaled_X, rescaled_y = _rescale_data(X, y, sample_weight)
      rescaled_X2 = X * np.sqrt(sample_weight)[:, np.newaxis]
      if n_targets is None:
          rescaled_y2 = y * np.sqrt(sample_weight)
      else:
          rescaled_y2 = y * np.sqrt(sample_weight)[:, np.newaxis]
      assert_array_almost_equal(rescaled_X, rescaled_X2)
      assert_array_almost_equal(rescaled_y, rescaled_y2)
  
imports: import re
  import numpy
  import pytest
  from numpy.testing import assert_array_almost_equal, assert_array_equal, assert_almost_equal, assert_allclose
  from scipy import sparse
  from scipy import linalg
  from sklearn.datasets import make_sparse_uncorrelated, make_regression, load_iris
  from sklearn.linear_model import LinearRegression
  from sklearn.linear_model._base import make_dataset
  from sklearn.utils import check_random_state
  from ..None import LinearRegression
  from .._base import _preprocess_data, _rescale_data
label_desc: Use image node_id 18 for calling a global function with example usage: test_rescale_data_dense(setup, n_targets) without return types