code: def test_sag_adaptive():
      # Check that the adaptive step size strategy yields the same
      # solution as the non-adaptive"""
      np.random.seed(0)
      X = sparse.rand(100, 10, density=0.5, random_state=0).tocsr()
      y = np.random.randint(0, high=2, size=100)
      for alpha in np.logspace(-3, 1, 5):
          clf_adaptive = SAGClassifier(
              eta="line-search", random_state=0, alpha=alpha
          )
          clf_adaptive.fit(X, y)
          clf = SAGClassifier(eta="auto", random_state=0, alpha=alpha)
          clf.fit(X, y)
          np.testing.assert_almost_equal(
              clf_adaptive.score(X, y), clf.score(X, y), 1
          )
  
          clf_adaptive = SAGAClassifier(
              eta="line-search",
              loss="log",
              random_state=0,
              alpha=alpha,
              max_iter=20,
          )
          clf_adaptive.fit(X, y)
          assert np.isnan(clf_adaptive.coef_.sum()) == False
          clf = SAGAClassifier(
              eta="auto",
              loss="log",
              random_state=0,
              alpha=alpha,
              max_iter=20,
          )
          clf.fit(X, y)
          np.testing.assert_almost_equal(
              clf_adaptive.score(X, y), clf.score(X, y), 1
          )
  
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 22 for calling a global function with example usage: test_sag_adaptive() without return types