code: def test_marginalize(self):
      phi2 = self.phi2.copy()
      phi2.marginalize(["x2"])
      self.assertEqual(phi2.scope(), ["x1"])
      for inp in np.random.rand(4):
          np_test.assert_almost_equal(
              phi2.pdf(inp), multivariate_normal.pdf([inp], [0], [[1]])
          )
  
      phi2 = self.phi2.marginalize(["x2"], inplace=False)
      self.assertEqual(phi2.scope(), ["x1"])
      for inp in np.random.rand(4):
          np_test.assert_almost_equal(
              phi2.pdf(inp), multivariate_normal.pdf([inp], [0], [[1]])
          )
  
      phi4 = self.phi4.copy()
      phi4.marginalize(["x2"])
  
      self.assertEqual(phi4.scope(), ["x1", "x3"])
      for inp in np.random.rand(4, 2):
          np_test.assert_almost_equal(
              phi4.pdf(inp[0], inp[1]),
              multivariate_normal.pdf(
                  [inp[0], inp[1]], [0, 0], [[1, 0], [0, 1]]
              ),
          )
  
      phi4.marginalize(["x3"])
      self.assertEqual(phi4.scope(), ["x1"])
      for inp in np.random.rand(1):
          np_test.assert_almost_equal(
              phi4.pdf(inp), multivariate_normal.pdf([inp], [0], [[1]])
          )
  
      phi4 = self.phi4.marginalize(["x2"], inplace=False)
      self.assertEqual(phi4.scope(), ["x1", "x3"])
      for inp in np.random.rand(4, 2):
          np_test.assert_almost_equal(
              phi4.pdf(inp[0], inp[1]),
              multivariate_normal.pdf(
                  [inp[0], inp[1]], [0, 0], [[1, 0], [0, 1]]
              ),
          )
  
      phi4 = phi4.marginalize(["x3"], inplace=False)
      self.assertEqual(phi4.scope(), ["x1"])
      for inp in np.random.rand(1):
          np_test.assert_almost_equal(
              phi4.pdf(inp), multivariate_normal.pdf([inp], [0], [[1]])
          )
  
imports: import unittest
  import numpy
  import numpy.testing
  from scipy.special import beta
  from scipy.stats import multivariate_normal
  from pgmpy.factors.continuous import ContinuousFactor
label_desc: Use image node_id 10 for calling the TestContinuousFactorMethods obj's underlying member method code with example usage: obj.test_marginalize() without return types