code: def test_bernoulli(x_dtype, y_dtype, is_sparse, nlp_20news):
      X, y = nlp_20news
      n_rows = 500
      n_cols = 20000
  
      X = sparse_scipy_to_cp(X, x_dtype).astype(x_dtype)
      y = y.astype(y_dtype)
  
      X = X.tocsr()[:n_rows, :n_cols]
      y = y[:n_rows]
      if not is_sparse:
          X = X.todense()
  
      sk_model = skBNB()
      cuml_model = BernoulliNB()
  
      sk_model.fit(X.get(), y.get())
      cuml_model.fit(X, y)
  
      sk_score = sk_model.score(X.get(), y.get())
      cuml_score = cuml_model.score(X, y)
      cuml_proba = cuml_model.predict_log_proba(X).get()
      sk_proba = sk_model.predict_log_proba(X.get())
  
      THRES = 1e-3
  
      assert_array_equal(
          sk_model.class_count_, cuml_model.class_count_.get()
      )
      assert_allclose(
          sk_model.class_log_prior_,
          cuml_model.class_log_prior_.get(),
          1e-6,
      )
      assert_allclose(cuml_proba, sk_proba, atol=1e-2, rtol=1e-2)
      assert sk_score - THRES <= cuml_score <= sk_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 5 for calling a global function with example usage: test_bernoulli(x_dtype, y_dtype, is_sparse, nlp_20news) without return types