code: def test_categorical_parameters(
      class_prior, alpha, fit_prior, is_sparse, nlp_20news
  ):
      x_dtype = cp.float32
      y_dtype = cp.int32
      nrows = 2000
      ncols = 500
  
      X, y = nlp_20news
  
      X = sparse_scipy_to_cp(X, x_dtype).tocsr()[:nrows, :ncols]
      if not is_sparse:
          X = X.todense()
      y = y.astype(y_dtype)[:nrows]
  
      if class_prior == "balanced":
          class_prior = np.array([1 / 20] * 20)
      elif class_prior == "unbalanced":
          class_prior = np.linspace(0.01, 0.09, 20)
  
      model = CategoricalNB(
          class_prior=class_prior, alpha=alpha, fit_prior=fit_prior
      )
      model_sk = skCNB(
          class_prior=class_prior, alpha=alpha, fit_prior=fit_prior
      )
      model.fit(X, y)
      y_hat = model.predict(X).get()
      y_log_prob = model.predict_log_proba(X).get()
  
      X = X.todense().get() if is_sparse else X.get()
      model_sk.fit(X, y.get())
      y_hat_sk = model_sk.predict(X)
      y_log_prob_sk = model_sk.predict_log_proba(X)
  
      assert_allclose(y_log_prob, y_log_prob_sk, rtol=1e-4)
      assert_array_equal(y_hat, y_hat_sk)
  
imports: from cuml.internals.safe_imports import cpu_only_import
  import math
  from sklearn.naive_bayes import GaussianNB
  from sklearn.naive_bayes import ComplementNB
  from sklearn.naive_bayes import CategoricalNB
  from sklearn.naive_bayes import BernoulliNB
  from sklearn.naive_bayes import MultinomialNB
  from numpy.testing import assert_array_almost_equal, assert_raises
  from numpy.testing import assert_allclose, assert_array_equal
  from cuml.datasets import make_classification
  from cuml.internals.input_utils import sparse_scipy_to_cp
  from cuml.naive_bayes import GaussianNB
  from cuml.naive_bayes import ComplementNB
  from cuml.naive_bayes import CategoricalNB
  from cuml.naive_bayes import BernoulliNB
  from cuml.naive_bayes import MultinomialNB
  from sklearn.metrics import accuracy_score
  import pytest
  from cuml.internals.safe_imports import gpu_only_import
label_desc: Use image node_id 15 for calling a global function with example usage: test_categorical_parameters(class_prior, alpha, fit_prior, is_sparse, nlp_20news) without return types