code: def test_fit(X, model, model2):
      model.fit(X)
      assert_array_almost_equal(
          model.factors[0].probs, [[0.4545, 0.5455]], 4
      )
      assert_array_almost_equal(
          model.factors[1].probs,
          [
              [[0.0909, 0.1818, 0.0000], [0.0909, 0.0000, 0.0909]],
              [[0.0000, 0.1818, 0.0909], [0.0909, 0.0909, 0.0909]],
          ],
          4,
      )
      assert_array_almost_equal(
          model.factors[2].probs, [[0.5455, 0.4545]], 4
      )
      assert_array_almost_equal(
          model.factors[3].probs,
          [[0.1818, 0.3636], [0.2727, 0.1818]],
          4,
      )
  
      assert_array_almost_equal(model.marginals[0].probs, [[0.5, 0.5]])
      assert_array_almost_equal(
          model.marginals[1].probs, [[1.0 / 3, 1.0 / 3, 1.0 / 3]]
      )
      assert_array_almost_equal(model.marginals[2].probs, [[0.5, 0.5]])
      assert_array_almost_equal(model.marginals[3].probs, [[0.5, 0.5]])
  
      model2.fit(X)
      assert_array_almost_equal(
          model2.factors[0].probs, [[0.4545, 0.5455]], 4
      )
      assert_array_almost_equal(
          model2.factors[1].probs,
          [
              [[0.0000, 0.0909, 0.0909], [0.0909, 0.2727, 0.0000]],
              [[0.0909, 0.0909, 0.0909], [0.0909, 0.0000, 0.0909]],
          ],
          4,
      )
      assert_array_almost_equal(
          model2.factors[2].probs,
          [[0.2727, 0.1818], [0.2727, 0.2727]],
          4,
      )
      assert_array_almost_equal(
          model2.factors[3].probs,
          [[0.2727, 0.1818], [0.1818, 0.3636]],
          4,
      )
  
      assert_array_almost_equal(model2.marginals[0].probs, [[0.5, 0.5]])
      assert_array_almost_equal(
          model2.marginals[1].probs, [[1.0 / 3, 1.0 / 3, 1.0 / 3]]
      )
      assert_array_almost_equal(model2.marginals[2].probs, [[0.5, 0.5]])
      assert_array_almost_equal(model2.marginals[3].probs, [[0.5, 0.5]])
  
imports: import numpy
  import torch
  import pytest
  from pomegranate.factor_graph import FactorGraph
  from pomegranate.distributions import Exponential
  from pomegranate.distributions import Categorical
  from pomegranate.distributions import JointCategorical
  from nose.tools import assert_raises
  from numpy.testing import assert_array_almost_equal
label_desc: Use image node_id 23 for calling a global function with example usage: test_fit(X, model, model2) without return types