code: def test_fit_chain(X, w, distributions):
      d1, d2, d3 = distributions
      d = IndependentComponents(distributions).fit(X, sample_weight=w)
      assert_array_almost_equal(d1.scales, [2.272727], 4)
      assert_array_almost_equal(d2.rates, [3.181162], 4)
      assert_array_almost_equal(d2.shapes, [4.627145], 4)
      assert_array_almost_equal(d3.probs, [[0.727273, 0.272727]], 4)
  
imports: import os
  import numpy
  import torch
  import pytest
  from pomegranate.distributions import Exponential
  from pomegranate.distributions import Gamma
  from pomegranate.distributions import Categorical
  from pomegranate.distributions import IndependentComponents
  from ._utils import _test_initialization_raises_one_parameter
  from ._utils import _test_initialization
  from ._utils import _test_predictions
  from ._utils import _test_efd_from_summaries
  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 23 for calling a global function with example usage: test_fit_chain(X, w, distributions) without return types