code: def test_categorical_partial_fit(
      x_dtype, y_dtype, is_sparse, nlp_20news
  ):
      if x_dtype == cp.int32 and is_sparse:
          pytest.skip(
              "Sparse matrices with integers dtype are not supported"
          )
      n_rows = 5000
      n_cols = 500
      chunk_size = 1000
      expected_score = 0.1040
  
      X, y = nlp_20news
  
      X = sparse_scipy_to_cp(X, "float32").tocsr()[:n_rows, :n_cols]
      if is_sparse:
          X.data = X.data.astype(x_dtype)
      else:
          X = X.todense().astype(x_dtype)
      y = y.astype(y_dtype)[:n_rows]
  
      model = CategoricalNB()
  
      classes = np.unique(y)
      for i in range(math.ceil(X.shape[0] / chunk_size)):
          upper = i * chunk_size + chunk_size
          if upper > X.shape[0]:
              upper = -1
  
          if upper > 0:
              x = X[i * chunk_size : upper]
              y_c = y[i * chunk_size : upper]
          else:
              x = X[i * chunk_size :]
              y_c = y[i * chunk_size :]
          model.partial_fit(x, y_c, classes=classes)
          if upper == -1:
              break
  
      cuml_score = model.score(X, y)
      THRES = 1e-4
      assert (
          expected_score - THRES <= cuml_score <= expected_score + THRES
      )
  
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 14 for calling a global function with example usage: test_categorical_partial_fit(x_dtype, y_dtype, is_sparse, nlp_20news) without return types