code: def test_logistic_regression_weighting(
      regression_dataset, option, test_status
  ):
      regression_type, data, coef, output = regression_dataset[
          test_status
      ]
  
      class_weight = None
      sample_weight = None
      if option == "sample_weight":
          n_samples = data.shape[0]
          sample_weight = np.abs(np.random.rand(n_samples))
      elif option == "class_weight":
          class_weight = np.random.rand(2)
          class_weight = {0: class_weight[0], 1: class_weight[1]}
      elif option == "balanced":
          class_weight = "balanced"
  
      culog = cuLog(fit_intercept=False, class_weight=class_weight)
      culog.fit(data, output, sample_weight=sample_weight)
  
      sklog = skLog(fit_intercept=False, class_weight=class_weight)
      sklog.fit(data, output, sample_weight=sample_weight)
  
      skcoef = np.squeeze(sklog.coef_)
      cucoef = np.squeeze(culog.coef_)
      if regression_type == "binary":
          skcoef /= np.linalg.norm(skcoef)
          cucoef /= np.linalg.norm(cucoef)
          unit_tol = 0.04
          total_tol = 0.08
      elif regression_type.startswith("multiclass"):
          skcoef /= np.linalg.norm(skcoef, axis=1)[:, None]
          cucoef /= np.linalg.norm(cucoef, axis=1)[:, None]
          unit_tol = 0.2
          total_tol = 0.3
  
      equality = array_equal(
          skcoef, cucoef, unit_tol=unit_tol, total_tol=total_tol
      )
      if not equality:
          print("\ncoef.shape: ", coef.shape)
          print("coef:\n", coef)
          print("cucoef.shape: ", cucoef.shape)
          print("cucoef:\n", cucoef)
      assert equality
  
      cuOut = culog.predict(data)
      skOut = sklog.predict(data)
      assert array_equal(
          skOut, cuOut, unit_tol=unit_tol, total_tol=total_tol
      )
  
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 27 for calling a global function with example usage: test_logistic_regression_weighting(regression_dataset, option, test_status) without return types