code: def test_weighted_linear_regression(
      ntargets, datatype, algorithm, fit_intercept, distribution
  ):
      nrows, ncols, n_info = 1000, 20, 10
      max_weight = 10
      noise = 20
  
      if 1 < ntargets and algorithm != "svd":
          pytest.skip(
              "The multi-target fit only supports using the svd solver."
          )
  
      X_train, X_test, y_train, y_test = make_regression_dataset(
          datatype,
          nrows,
          ncols,
          n_info,
          noise=noise,
          n_targets=ntargets,
      )
  
      # set weight per sample to be from 1 to max_weight
      if distribution == "uniform":
          wt = np.random.randint(1, high=max_weight, size=len(X_train))
      elif distribution == "exponential":
          wt = np.random.exponential(size=len(X_train))
      else:
          wt = np.random.lognormal(size=len(X_train))
  
      # Initialization of cuML's linear regression model
      cuols = cuLinearRegression(
          fit_intercept=fit_intercept, algorithm=algorithm
      )
  
      # fit and predict cuml linear regression model
      cuols.fit(X_train, y_train, sample_weight=wt)
      cuols_predict = cuols.predict(X_test)
  
      # sklearn linear regression model initialization, fit and predict
      skols = skLinearRegression(fit_intercept=fit_intercept)
      skols.fit(X_train, y_train, sample_weight=wt)
  
      skols_predict = skols.predict(X_test)
  
      assert array_equal(
          skols_predict, cuols_predict, 1e-1, with_sign=True
      )
  
imports: from contextlib import nullcontext
  from distutils.version import LooseVersion
  from functools import lru_cache
  import pytest
  import sklearn
  from cuml.internals.array import elements_in_representable_range
  from cuml.internals.safe_imports import cpu_only_import, cpu_only_import_from, gpu_only_import
  from cuml.testing.strategies import regression_datasets, split_datasets, standard_classification_datasets, standard_regression_datasets
  from cuml.testing.utils import array_difference, array_equal, quality_param, small_classification_dataset, small_regression_dataset, stress_param, unit_param
  from hypothesis import assume, example, given, note
  from hypothesis import strategies
  from hypothesis import target
  from hypothesis.extra.numpy import floating_dtypes
  from sklearn.datasets import load_breast_cancer, load_digits, make_classification, make_regression
  from sklearn.linear_model import LinearRegression
  from sklearn.linear_model import LogisticRegression
  from sklearn.linear_model import Ridge
  from sklearn.model_selection import train_test_split
  from cuml import ElasticNet
  from cuml import LinearRegression
  from cuml import LogisticRegression
  from cuml import Ridge
label_desc: Use image node_id 8 for calling a global function with example usage: test_weighted_linear_regression(ntargets, datatype, algorithm, fit_intercept, distribution) without return types