code: def test_reduce(self):
      phi = self.phi1.reduce([("x1", 7)], inplace=False)
      self.assertEqual(phi.variables, ["x2", "x3"])
      np_test.assert_almost_equal(
          phi.K, np.array([[4.0, -2.0], [-2.0, 4.0]])
      )
      np_test.assert_almost_equal(phi.h, np.array([[11.7], [-1.0]]))
      np_test.assert_almost_equal(phi.g, -21.95)
  
      phi = self.phi1.reduce([("x1", 4), ("x2", 1.23)], inplace=False)
      self.assertEqual(phi.variables, ["x3"])
      np_test.assert_almost_equal(phi.K, np.array([[4.0]]))
      np_test.assert_almost_equal(phi.h, np.array([[1.46]]))
      np_test.assert_almost_equal(phi.g, 0.8752)
  
      self.phi1.reduce([("x1", 7)])
      self.assertEqual(self.phi1.variables, ["x2", "x3"])
      np_test.assert_almost_equal(
          self.phi1.K, np.array([[4.0, -2.0], [-2.0, 4.0]])
      )
      np_test.assert_almost_equal(
          self.phi1.h, np.array([[11.7], [-1.0]])
      )
      np_test.assert_almost_equal(self.phi1.g, -21.95)
  
      self.phi1 = self.phi3.copy()
      self.phi1.reduce([("x1", 4), ("x2", 1.23)])
      self.assertEqual(self.phi1.variables, ["x3"])
      np_test.assert_almost_equal(self.phi1.K, np.array([[4.0]]))
      np_test.assert_almost_equal(self.phi1.h, np.array([[1.46]]))
      np_test.assert_almost_equal(self.phi1.g, 0.8752)
  
      self.phi1 = self.phi3.copy()
      self.phi1.reduce([("x2", 1.23), ("x1", 4)])
      self.assertEqual(self.phi1.variables, ["x3"])
      np_test.assert_almost_equal(self.phi1.K, np.array([[4.0]]))
      np_test.assert_almost_equal(self.phi1.h, np.array([[1.46]]))
      np_test.assert_almost_equal(self.phi1.g, 0.8752)
  
file_path: pgmpy/pgmpy/tests/test_factors/test_continuous/test_Canonical_Factor.py
imports: import unittest
  import numpy
  import numpy.testing
  from pgmpy.factors.distributions import GaussianDistribution
  from pgmpy.factors.continuous import CanonicalDistribution
label_desc: Use image node_id 4 for calling the TestJGDMethods obj's underlying member method code with example usage: obj.test_reduce() without return types