code: def test_fit_weighted(X, w, probs):
      for param in probs, None:
          d = ConditionalCategorical(param)
          d.fit(X[:4], sample_weight=w[:4])
          _test_efd_from_summaries(
              d,
              "probs",
              "_log_probs",
              [
                  [[0.50, 0.50], [1.00, 0.00]],
                  [[0.50, 0.50], [0.50, 0.50], [0.7179487, 0.2820513]],
                  [[1.00, 0.00], [0.00, 1.00]],
              ],
          )
  
          d.fit(X[4:], sample_weight=w[4:])
          _test_efd_from_summaries(
              d,
              "probs",
              "_log_probs",
              [
                  [[1.00, 0.00], [0.75342464, 0.24657533]],
                  [[0.50, 0.50], [0.4270833, 0.5729166], [0.50, 0.50]],
                  [[1.00, 0.00], [0.00, 1.00]],
              ],
          )
  
          d = ConditionalCategorical(param)
          d.fit(X, sample_weight=w)
          _test_efd_from_summaries(
              d,
              "probs",
              "_log_probs",
              [
                  [[1.0, 0.0], [0.8392857, 0.16071428]],
                  [
                      [0.50, 0.50],
                      [0.4270833, 0.5729166],
                      [0.7179487, 0.2820513],
                  ],
                  [[1.00, 0.00], [0.00, 1.00]],
              ],
          )
  
imports: import numpy
  import torch
  import pytest
  from pomegranate.distributions import ConditionalCategorical
  from ._utils import _test_initialization_raises_one_parameter
  from ._utils import _test_initialization
  from ._utils import _test_predictions
  from ._utils import _test_raises
  from nose.tools import assert_raises
  from numpy.testing import assert_array_almost_equal
label_desc: Use image node_id 32 for calling a global function with example usage: test_fit_weighted(X, w, probs) without return types