code: def test_sag_sample_weights(train_data):
      X, y = train_data
      clf1 = SAGAClassifier(
          loss="log", max_iter=5, verbose=0, random_state=0
      )
      clf2 = SAGAClassifier(
          loss="log", max_iter=5, verbose=0, random_state=0
      )
      clf1.fit(X, y)
      sample_weights = [1] * y.size
      clf2.fit(X, y, sample_weight=sample_weights)
      np.testing.assert_array_equal(
          clf1.coef_.ravel(), clf2.coef_.ravel()
      )
  
      # same thing but for a regression object
      alpha = 1.0
      clf1 = SAGARegressor(
          loss="squared", alpha=alpha, max_iter=5, random_state=0
      )
      clf1.fit(X, y)
      sample_weights = [2] * y.size
      # alpha needs to be multiplied accordingly
      clf2 = SAGARegressor(
          loss="squared", alpha=2 * alpha, max_iter=5, random_state=0
      )
      clf2.fit(X, y, sample_weight=sample_weights)
      np.testing.assert_array_equal(
          clf1.coef_.ravel(), clf2.coef_.ravel()
      )
  
      #
      # check that samples with a zero weight do not have an influence on the
      # resulting coefficients by adding noise to original samples
      X2 = np.concatenate(
          (X, np.random.randn(*X.shape)), axis=0
      )  # augment with noise
      y2 = np.concatenate((y, y), axis=0)
      sample_weights = np.ones(y2.size, dtype=float)
      sample_weights[X.shape[0] :] = 0.0
  
      clf1 = SAGARegressor(
          loss="squared",
          alpha=alpha,
          max_iter=100,
          random_state=0,
          tol=1e-24,
      )
      clf1.fit(X, y)
      clf2 = SAGARegressor(
          loss="squared",
          alpha=0.5 * alpha,
          max_iter=100,
          random_state=0,
          tol=1e-24,
      )
      clf2.fit(X2, y2, sample_weight=sample_weights)
      np.testing.assert_array_almost_equal(
          clf1.coef_.ravel(), clf2.coef_.ravel(), decimal=6
      )
  
imports: import numpy
  import pytest
  from scipy import sparse
  from sklearn.datasets import make_classification
  from lightning.impl.base import BaseClassifier
  from lightning.impl.dataset_fast import get_dataset
  from lightning.classification import SAGClassifier, SAGAClassifier
  from lightning.regression import SAGRegressor, SAGARegressor
  from lightning.impl.sgd_fast import ModifiedHuber
  from lightning.impl.sgd_fast import SmoothHinge
  from lightning.impl.sgd_fast import SquaredHinge
  from lightning.impl.sgd_fast import Log
  from lightning.impl.sgd_fast import SquaredLoss
  from lightning.impl.sag import get_auto_step_size
  from lightning.impl.tests.utils import check_predict_proba
label_desc: Use image node_id 21 for calling a global function with example usage: test_sag_sample_weights(train_data) without return types