code: def test_initialization():
      model = FactorGraph()
      assert len(model.factors) == 0
      assert len(model.marginals) == 0
      assert len(model._factor_idxs) == 0
      assert len(model._marginal_idxs) == 0
  
      m = Categorical([[0.5, 0.5]])
      f = Categorical([[0.8, 0.1]])
      model = FactorGraph([f], [m])
      assert len(model.factors) == 1
      assert len(model.marginals) == 1
      assert len(model._factor_idxs) == 1
      assert len(model._marginal_idxs) == 1
      assert sum(map(len, model._factor_edges)) == 0
      assert sum(map(len, model._marginal_edges)) == 0
  
      model = FactorGraph([f], [m], [(m, f)])
      assert len(model.factors) == 1
      assert len(model.marginals) == 1
      assert len(model._factor_idxs) == 1
      assert len(model._marginal_idxs) == 1
      assert sum(map(len, model._factor_edges)) == 1
      assert sum(map(len, model._marginal_edges)) == 1
  
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 6 for calling a global function with example usage: test_initialization() without return types