code: def test_model_against_sklearn(
      est, skl_params, data_generator, fit_intercept, solver, request
  ):
      """
      Test accuracy of model predictions and coefficients.
  
      All tests of model coefficients are done via relative error, the
      standard for optimization proofs, and by the numpy utility
      ``np.testing.assert_allclose``. This ensures that the model coefficients
      match up with SK Learn.
      """
      X, y = request.getfixturevalue(data_generator)
  
      # sklearn uses 'PoissonRegressor' while dask-ml uses 'PoissonRegression'
      assert est in [
          "LinearRegression",
          "LogisticRegression",
          "PoissonRegression",
      ]
      EstDask = getattr(dask_ml.linear_model, est)
      EstSklearn = getattr(
          sklearn.linear_model,
          est if "Poisson" not in est else "PoissonRegressor",
      )
  
      dask_ml_model = EstDask(
          fit_intercept=fit_intercept,
          solver=solver,
          penalty="l2",
          C=1e8,
          max_iter=500,
      )
      dask_ml_model.fit(X, y)
  
      # skl_model has to be fit with numpy data
      skl_model = EstSklearn(fit_intercept=fit_intercept, **skl_params)
      skl_model.fit(X.compute(), y.compute())
  
      # test coefficients
      est, truth = np.hstack(
          (dask_ml_model.intercept_, dask_ml_model.coef_)
      ), np.hstack((skl_model.intercept_, skl_model.coef_.flatten()))
      rel_error = LA.norm(est - truth) / LA.norm(truth)
      assert rel_error < 1e-3
  
      np.testing.assert_allclose(truth, est, rtol=1e-3, atol=2e-4)
  
      # test predictions
      skl_preds = skl_model.predict(X.compute())
      dml_preds = dask_ml_model.predict(X)
  
      np.testing.assert_allclose(
          skl_preds, dml_preds, rtol=1e-3, atol=2e-3
      )
  
imports: import dask.array
  import dask.dataframe
  import numpy
  import numpy.linalg
  import pandas
  import pytest
  import sklearn.linear_model
  from dask.dataframe.utils import assert_eq
  from dask_glm.regularizers import Regularizer
  from sklearn.pipeline import make_pipeline
  import dask_ml.linear_model
  from dask_ml.datasets import make_classification, make_counts, make_regression
  from dask_ml.linear_model import LinearRegression, LogisticRegression, PoissonRegression
  from dask_ml.linear_model.utils import add_intercept
  from dask_ml.model_selection import GridSearchCV
label_desc: Use image node_id 22 for calling a global function with example usage: test_model_against_sklearn(est, skl_params, data_generator, fit_intercept, solver, request) without return types