code: def test_sag_sparse(SAG_):
      # FIX for https://github.com/mblondel/lightning/issues/33
      # check that SAG has the same results with dense
      # and sparse data
      X = sparse.rand(100, 50, density=0.5, random_state=0)
      y = np.random.randint(0, high=2, size=100)
      for alpha in np.logspace(-3, 3, 10):
          clf_sparse = SAG_(
              eta=1.0, max_iter=1, random_state=0, alpha=alpha
          )
          clf_sparse.fit(X, y)
          clf_dense = SAG_(
              eta=1.0, max_iter=1, random_state=0, alpha=alpha
          )
          clf_dense.fit(X.toarray(), y)
          assert clf_sparse.score(X, y) == clf_dense.score(X, y)
  
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 20 for calling a global function with example usage: test_sag_sparse(SAG_) without return types