code: def test_qn(
      loss, dtype, penalty, l1_strength, l2_strength, fit_intercept
  ):
      if penalty == "none" and (l1_strength > 0 or l2_strength > 0):
          pytest.skip("`none` penalty does not take l1/l2_strength")
  
      tol = 1e-6
  
      qn = cuQN(
          loss=loss,
          fit_intercept=fit_intercept,
          l1_strength=l1_strength,
          l2_strength=l2_strength,
          tol=1e-8,
          output_type="cupy",
      )
  
      if loss == "softmax":
          X, y = make_classification(
              n_samples=5000,
              n_informative=10,
              n_features=20,
              n_classes=4,
              dtype=dtype,
          )
  
          stratify = y.astype(dtype)
          X_train, X_test, y_train, y_test = train_test_split(
              X.astype(dtype), y.astype(dtype), stratify=stratify
          )
          most_class = cp.unique(y)[cp.argmax(cp.bincount(y))]
  
          baseline_preds = cp.array(
              [most_class] * y_test.shape[0], dtype=dtype
          )
          baseline_score = accuracy_score(y_test, baseline_preds)
  
          y_pred = qn.fit(X_train, y_train).predict(X_test)
          cuml_score = accuracy_score(y_test, y_pred)
  
          assert cuml_score > baseline_score
          assert cuml_score >= 0.50
  
      elif loss == "sigmoid":
          X = np.array(precomputed_X, dtype=dtype)
          y = np.array(precomputed_y_log, dtype=dtype)
          qn.fit(X, y)
          print(qn.objective)
          print(qn.coef_)
  
          if (
              penalty == "none"
              and l1_strength == 0.0
              and l2_strength == 0.0
          ):
              if fit_intercept:
                  assert (qn.objective - 0.40263831615448) < tol
                  cp.testing.assert_array_almost_equal(
                      qn.coef_,
                      np.array([[-2.1088872, 2.4812558]]),
                      decimal=3,
                  )
              else:
                  assert (qn.objective - 0.4317452311515808) < tol
                  cp.testing.assert_array_almost_equal(
                      qn.coef_,
                      np.array([[-2.120777, 3.056865]]),
                      decimal=3,
                  )
          elif penalty == "l1" and l2_strength == 0.0:
              if fit_intercept:
                  if l1_strength == 0.0:
                      assert (qn.objective - 0.40263831615448) < tol
                      cp.testing.assert_array_almost_equal(
                          qn.coef_,
                          np.array([[-2.1088872, 2.4812558]]),
                          decimal=3,
                      )
                  else:
                      assert (qn.objective - 0.44295936822891235) < tol
                      cp.testing.assert_array_almost_equal(
                          qn.coef_,
                          np.array([[-1.6899368, 1.9021575]]),
                          decimal=3,
                      )
  
              else:
                  if l1_strength == 0.0:
                      assert (qn.objective - 0.4317452311515808) < tol
                      cp.testing.assert_array_almost_equal(
                          qn.coef_,
                          np.array([[-2.120777, 3.056865]]),
                          decimal=3,
                      )
  
                  else:
                      assert (qn.objective - 0.4769895672798157) < tol
                      cp.testing.assert_array_almost_equal(
                          qn.coef_,
                          np.array([[-1.6214856, 2.3650239]]),
                          decimal=3,
                      )
  
                  # assert False
  
          elif penalty == "l2" and l1_strength == 0.0:
              if fit_intercept:
                  if l2_strength == 0.0:
                      assert (qn.objective - 0.40263831615448) < tol
                      cp.testing.assert_array_almost_equal(
                          qn.coef_,
                          np.array([[-2.1088872, 2.4812558]]),
                          decimal=3,
                      )
                  else:
                      assert (qn.objective - 0.43780848383903503) < tol
                      cp.testing.assert_array_almost_equal(
                          qn.coef_,
                          np.array([[-1.5337948, 1.678699]]),
                          decimal=3,
                      )
  
              else:
                  if l2_strength == 0.0:
                      assert (qn.objective - 0.4317452311515808) < tol
                      cp.testing.assert_array_almost_equal(
                          qn.coef_,
                          np.array([[-2.120777, 3.056865]]),
                          decimal=3,
                      )
  
                  else:
                      assert (qn.objective - 0.4750209450721741) < tol
                      cp.testing.assert_array_almost_equal(
                          qn.coef_,
                          np.array([[-1.3931049, 2.0140104]]),
                          decimal=3,
                      )
  
          if penalty == "elasticnet":
              if fit_intercept:
                  if l1_strength == 0.0 and l2_strength == 0.0:
                      assert (qn.objective - 0.40263831615448) < tol
                      cp.testing.assert_array_almost_equal(
                          qn.coef_,
                          np.array([[-2.1088872, 2.4812558]]),
                          decimal=3,
                      )
                  elif l1_strength == 0.0:
                      assert (qn.objective - 0.43780848383903503) < tol
                      cp.testing.assert_array_almost_equal(
                          qn.coef_,
                          np.array([[-1.5337948, 1.678699]]),
                          decimal=3,
                      )
                  elif l2_strength == 0.0:
                      assert (qn.objective - 0.44295936822891235) < tol
                      cp.testing.assert_array_almost_equal(
                          qn.coef_,
                          np.array([[-1.6899368, 1.9021575]]),
                          decimal=3,
                      )
                  else:
                      assert (qn.objective - 0.467987984418869) < tol
                      cp.testing.assert_array_almost_equal(
                          qn.coef_,
                          np.array([[-1.3727235, 1.4639963]]),
                          decimal=3,
                      )
              else:
                  if l1_strength == 0.0 and l2_strength == 0.0:
                      assert (qn.objective - 0.4317452311515808) < tol
                      cp.testing.assert_array_almost_equal(
                          qn.coef_,
                          np.array([[-2.120777, 3.056865]]),
                          decimal=3,
                      )
                  elif l1_strength == 0.0:
                      assert (qn.objective - 0.4750209450721741) < tol
                      cp.testing.assert_array_almost_equal(
                          qn.coef_,
                          np.array([[-1.3931049, 2.0140104]]),
                          decimal=3,
                      )
  
                  elif l2_strength == 0.0:
                      assert (qn.objective - 0.4769895672798157) < tol
                      cp.testing.assert_array_almost_equal(
                          qn.coef_,
                          np.array([[-1.6214856, 2.3650239]]),
                          decimal=3,
                      )
                  else:
                      assert (qn.objective - 0.5067970156669617) < tol
                      cp.testing.assert_array_almost_equal(
                          qn.coef_,
                          np.array([[-1.2102532, 1.752459]]),
                          decimal=3,
                      )
  
                  print()
  
imports: from cuml.metrics import accuracy_score
  from cuml.datasets.classification import make_classification
  from cuml.model_selection import train_test_split
  from cuml.solvers import QN
  from cuml.internals.safe_imports import gpu_only_import
  import pytest
  from cuml.internals.safe_imports import cpu_only_import
label_desc: Use image node_id 1 for calling a global function with example usage: test_qn(loss, dtype, penalty, l1_strength, l2_strength, fit_intercept) without return types