code: def test_summarize_weighted(X, w, distributions):
      d1, d2, d3, d4, d12, d22, d32, d13 = distributions
      model = BayesianNetwork(
          [d13, d22, d32, d4],
          [(d4, d22), (d4, d32), (d22, d13), (d32, d13)],
      )
  
      model.summarize(X[:4], sample_weight=w[:4])
      model.summarize(X[4:], sample_weight=w[4:])
      model.from_summaries()
  
      assert_array_almost_equal(
          model.distributions[0].probs[0],
          [
              [[1.0000, 0.0000], [1.0000, 0.0000]],
              [[0.5701, 0.4299], [0.5000, 0.5000]],
              [[0.5000, 0.5000], [0.2000, 0.8000]],
          ],
          4,
      )
      assert_array_almost_equal(
          model.distributions[1].probs[0],
          [[0.8125, 0.0000, 0.1875], [0.2171, 0.7039, 0.0789]],
          4,
      )
      assert_array_almost_equal(
          model.distributions[2].probs[0],
          [[0.0000, 1.0000], [0.9211, 0.0789]],
          4,
      )
      assert_array_almost_equal(
          model.distributions[3].probs, [[0.0952, 0.9048]], 4
      )
  
imports: import numpy
  import torch
  import pytest
  from pomegranate.bayesian_network import BayesianNetwork
  from pomegranate.distributions import Exponential
  from pomegranate.distributions import Categorical
  from pomegranate.distributions import ConditionalCategorical
  from nose.tools import assert_raises
  from numpy.testing import assert_array_equal
  from numpy.testing import assert_array_almost_equal
label_desc: Use image node_id 34 for calling a global function with example usage: test_summarize_weighted(X, w, distributions) without return types