code: def test_summarize(X, model, model2):
      model.summarize(X)
      assert_array_almost_equal(model.factors[0].probs, [[0.23, 0.77]])
      assert_array_almost_equal(
          model.factors[1].probs,
          [
              [[0.10, 0.05, 0.05], [0.15, 0.05, 0.04]],
              [[0.20, 0.10, 0.05], [0.05, 0.10, 0.06]],
          ],
      )
      assert_array_almost_equal(model.factors[2].probs, [[0.61, 0.39]])
      assert_array_almost_equal(
          model.factors[3].probs, [[0.17, 0.15], [0.4, 0.28]]
      )
  
      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.summarize(X)
      assert_array_almost_equal(
          model2.factors[0].probs, [[0.23, 0.77]], 4
      )
      assert_array_almost_equal(
          model2.factors[1].probs,
          [
              [[0.10, 0.05, 0.05], [0.15, 0.05, 0.04]],
              [[0.20, 0.10, 0.05], [0.05, 0.10, 0.06]],
          ],
      )
      assert_array_almost_equal(
          model2.factors[2].probs, [[0.17, 0.15], [0.4, 0.28]]
      )
      assert_array_almost_equal(
          model2.factors[3].probs, [[0.32, 0.12], [0.08, 0.48]]
      )
  
      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 25 for calling a global function with example usage: test_summarize(X, model, model2) without return types