code: def test_masked_fit(X, X_masked, y):
      X = torch.tensor(numpy.array(X))
      mask = torch.ones_like(X).type(torch.bool)
      X_ = torch.masked.MaskedTensor(X, mask=mask)
  
      d = [Exponential([2.1, 0.3, 1.1]), Exponential([1.5, 3.1, 2.2])]
      model = BayesClassifier(d)
      model.fit(X_, y)
  
      assert_array_almost_equal(model._w_sum, [0.0, 0.0])
      assert_array_almost_equal(model.priors, [0.545455, 0.454545])
      assert_array_almost_equal(
          model._log_priors, numpy.log([0.545455, 0.454545])
      )
  
      d = [Exponential([2.1, 0.3, 0.1]), Exponential([1.5, 3.1, 2.2])]
      model = BayesClassifier(d)
      model.fit(X_masked, y)
  
      assert_array_almost_equal(model._w_sum, [0.0, 0.0])
      assert_array_almost_equal(model.priors, [0.444444, 0.555556])
      assert_array_almost_equal(
          model._log_priors, numpy.log([0.444444, 0.555556])
      )
  
imports: import os
  import numpy
  import torch
  import pytest
  from pomegranate.bayes_classifier import BayesClassifier
  from pomegranate.distributions import Exponential
  from .distributions._utils import _test_initialization_raises_one_parameter
  from .distributions._utils import _test_initialization
  from .distributions._utils import _test_predictions
  from .distributions._utils import _test_efd_from_summaries
  from .distributions._utils import _test_raises
  from nose.tools import assert_raises
  from numpy.testing import assert_array_almost_equal
label_desc: Use image node_id 42 for calling a global function with example usage: test_masked_fit(X, X_masked, y) without return types