class_docstr: The intermediate factors in a Gaussian network can be described
  compactly using a simple parametric representation called the
  canonical form. This representation is closed under the basic
  operations used in inference: factor product, factor division,
  factor reduction, and marginalization. Thus, we define this
  CanonicalDistribution class that allows the inference process to be
  performed on joint Gaussian networks.
  
  A canonical form C (X; K,h,g) is defined as
  
  C (X; K,h,g) = exp( ((-1/2) * X.T * K * X) + (h.T * X) + g)
  
  References
  ----------
  Probabilistic Graphical Models, Principles and Techniques,
  Daphne Koller and Nir Friedman, Section 14.2, Chapter 14.
class_docstr_tok: ["The","intermediate","factors","in","a","Gaussian","network","can","be","described","compactly","using","a","simple","parametric","representation","called","the","canonical","form",".","This","representation","is","closed","under","the","basic","operations","used","in","inference",":","factor","product",",","factor","division",",","factor","reduction",",","and","marginalization",".","Thus",",","we","define","this","CanonicalDistribution","class","that","allows","the","inference","process","to","be","performed","on","joint","Gaussian","networks",".","A","canonical","form","C","(","X\u037e","K",",","h",",","g",")","is","defined","as","C","(","X\u037e","K",",","h",",","g",")","=","exp","(","(","(","-1\/2",")","*","X.T","*","K","*","X",")","+","(","h.T","*","X",")","+","g",")","References","--","--","--","--","--","Probabilistic","Graphical","Models",",","Principles","and","Techniques",",","Daphne","Koller","and","Nir","Friedman",",","Section","14.2",",","Chapter","14","."]
docstr: Returns the product of two gaussian distributions.
  
  Parameters
  ----------
  other: CanonicalFactor
      The GaussianDistribution to be multiplied.
  
  inplace: boolean
      If True, modifies the distribution itself, otherwise returns a new
      CanonicalDistribution object.
  
  Returns
  -------
  CanonicalDistribution or None:
              if inplace=True (default) returns None.
              if inplace=False returns a new CanonicalDistribution instance.
  
  Examples
  --------
  >>> import numpy as np
  >>> from pgmpy.factors.distributions import GaussianDistribution as GD
  >>> dis1 = GD(['x1', 'x2', 'x3'], np.array([[1], [-3], [4]]),
  ...            np.array([[4, 2, -2], [2, 5, -5], [-2, -5, 8]]))
  >>> dis2 = GD(['x3', 'x4'], [1, 2], [[2, 3], [5, 6]])
  >>> dis3 = dis1.product(dis2, inplace=False)
  >>> dis3.covariance
  array([[ 3.6,  1. , -0.4, -0.6],
         [ 1. ,  2.5, -1. , -1.5],
         [-0.4, -1. ,  1.6,  2.4],
         [-1. , -2.5,  4. ,  4.5]])
  >>> dis3.mean
  array([[ 1.6],
         [-1.5],
         [ 1.6],
         [ 3.5]])
docstr_tok: ["Returns","the","product","of","two","gaussian","distributions",".","Parameters","--","--","--","--","--","other",":","CanonicalFactor","The","GaussianDistribution","to","be","multiplied",".","inplace",":","boolean","If","True",",","modifies","the","distribution","itself",",","otherwise","returns","a","new","CanonicalDistribution","object",".","Returns","--","--","--","-","CanonicalDistribution","or","None",":","if","inplace=True","(","default",")","returns","None",".","if","inplace=False","returns","a","new","CanonicalDistribution","instance",".","Examples","--","--","--","--",">",">",">","import","numpy","as","np",">",">",">","from","pgmpy.factors.distributions","import","GaussianDistribution","as","GD",">",">",">","dis1","=","GD","(","[","'x1","'",",","'x2","'",",","'x3","'","]",",","np.array","(","[","[","1","]",",","[","-3","]",",","[","4","]","]",")",",","...","np.array","(","[","[","4",",","2",",","-2","]",",","[","2",",","5",",","-5","]",",","[","-2",",","-5",",","8","]","]",")",")",">",">",">","dis2","=","GD","(","[","'x3","'",",","'x4","'","]",",","[","1",",","2","]",",","[","[","2",",","3","]",",","[","5",",","6","]","]",")",">",">",">","dis3","=","dis1.product","(","dis2",",","inplace=False",")",">",">",">","dis3.covariance","array","(","[","[","3.6",",","1.",",","-0.4",",","-0.6","]",",","[","1.",",","2.5",",","-1.",",","-1.5","]",",","[","-0.4",",","-1.",",","1.6",",","2.4","]",",","[","-1.",",","-2.5",",","4.",",","4.5","]","]",")",">",">",">","dis3.mean","array","(","[","[","1.6","]",",","[","-1.5","]",",","[","1.6","]",",","[","3.5","]","]",")"]
code: def product(self, other, inplace=True):
      """
      Returns the product of two gaussian distributions.
  
      Parameters
      ----------
      other: CanonicalFactor
          The GaussianDistribution to be multiplied.
  
      inplace: boolean
          If True, modifies the distribution itself, otherwise returns a new
          CanonicalDistribution object.
  
      Returns
      -------
      CanonicalDistribution or None:
                  if inplace=True (default) returns None.
                  if inplace=False returns a new CanonicalDistribution instance.
  
      Examples
      --------
      >>> import numpy as np
      >>> from pgmpy.factors.distributions import GaussianDistribution as GD
      >>> dis1 = GD(['x1', 'x2', 'x3'], np.array([[1], [-3], [4]]),
      ...            np.array([[4, 2, -2], [2, 5, -5], [-2, -5, 8]]))
      >>> dis2 = GD(['x3', 'x4'], [1, 2], [[2, 3], [5, 6]])
      >>> dis3 = dis1.product(dis2, inplace=False)
      >>> dis3.covariance
      array([[ 3.6,  1. , -0.4, -0.6],
             [ 1. ,  2.5, -1. , -1.5],
             [-0.4, -1. ,  1.6,  2.4],
             [-1. , -2.5,  4. ,  4.5]])
      >>> dis3.mean
      array([[ 1.6],
             [-1.5],
             [ 1.6],
             [ 3.5]])
      """
      return self._operate(other, operation="product", inplace=inplace)
  
file_path: pgmpy/pgmpy/factors/distributions/CanonicalDistribution.py
imports: import numpy
  from pgmpy.factors.distributions import BaseDistribution
  from pgmpy.factors.distributions import GaussianDistribution
label_desc: Use image node_id 9 for calling the CanonicalDistribution obj's underlying member method code with example usage: obj.product(other, inplace) and returns: self