code: def test_gaussian_partial_fit(nlp_20news):
      chunk_size = 250
      n_rows = 1500
      n_cols = 60000
      x_dtype, y_dtype = cp.float32, cp.int32
  
      X, y = nlp_20news
  
      X = sparse_scipy_to_cp(X, x_dtype).tocsr()[:n_rows, :n_cols]
      y = y.astype(y_dtype)[:n_rows]
  
      model = GaussianNB()
  
      classes = np.unique(y)
  
      total_fit = 0
  
      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)
  
          total_fit += upper - (i * chunk_size)
          if upper == -1:
              break
  
      y_hat = model.predict(X)
  
      y_hat = cp.asnumpy(y_hat)
      y = cp.asnumpy(y)
      assert accuracy_score(y, y_hat) >= 0.99
  
      # Test whether label mismatch between target y and classes raises an Error
      assert_raises(
          ValueError,
          GaussianNB().partial_fit,
          X,
          y,
          classes=cp.array([0, 1]),
      )
      # Raise because classes is required on first call of partial_fit
      assert_raises(ValueError, GaussianNB().partial_fit, X, y)
  
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 11 for calling a global function with example usage: test_gaussian_partial_fit(nlp_20news) without return types