code: def test_sparse_nlp20news(dtype, nlp_20news, client):
      X, y = nlp_20news
      n_parts = 2  # partitions_per_worker
  
      from scipy.sparse import csr_matrix
      from sklearn.model_selection import train_test_split
  
      X = X.astype(dtype)
  
      X = csr_matrix(X)
      y = y.get().astype(dtype)
  
      X_train, X_test, y_train, y_test = train_test_split(
          X, y, random_state=42
      )
  
      from cuml.dask.linear_model import LogisticRegression as MG
  
      X_train_da, y_train_da = _prep_training_data_sparse(
          client, X_train, y_train, partitions_per_worker=n_parts
      )
      X_test_da, _ = _prep_training_data_sparse(
          client, X_test, y_test, partitions_per_worker=n_parts
      )
  
      cumg = MG(verbose=6, C=20.0)
      cumg.fit(X_train_da, y_train_da)
  
      preds = cumg.predict(X_test_da).compute()
      cuml_score = accuracy_score(y_test, preds.tolist())
  
      from sklearn.linear_model import LogisticRegression as CPULR
  
      cpu = CPULR(C=20.0)
      cpu.fit(X_train, y_train)
      cpu_preds = cpu.predict(X_test)
      cpu_score = accuracy_score(y_test, cpu_preds.tolist())
      assert (
          cuml_score >= cpu_score
          or np.abs(cuml_score - cpu_score) < 1e-3
      )
  
imports: from cuml.internals.safe_imports import gpu_only_import
  import pytest
  from cuml.dask.common import utils
  from functools import partial
  from sklearn.metrics import accuracy_score, mean_squared_error
  from sklearn.datasets import make_classification
  from sklearn.linear_model import LogisticRegression
  from cuml.internals.safe_imports import cpu_only_import
  from cuml.testing.utils import array_equal
  from scipy.sparse import csr_matrix
label_desc: Use image node_id 15 for calling a global function with example usage: test_sparse_nlp20news(dtype, nlp_20news, client) without return types