class_docstr: Base class for factors representing various multivariate
  representations.
docstr: Marginalize the factor with respect to the given variables.
  
  Parameters
  ----------
  variables: list, array-like
      List of variables with respect to which factor is to be maximized.
  
  inplace: boolean
      If inplace=True it will modify the factor itself, else would return
      a new ContinuousFactor instance.
  
  Returns
  -------
  DiscreteFactor or None: if inplace=True (default) returns None
                  if inplace=False returns a new ContinuousFactor instance.
  
  Examples
  --------
  >>> from pgmpy.factors.continuous import ContinuousFactor
  >>> from scipy.stats import multivariate_normal
  >>> std_normal_pdf = lambda *x: multivariate_normal.pdf(x, [0, 0], [[1, 0], [0, 1]])
  >>> std_normal = ContinuousFactor(['x1', 'x2'], std_normal_pdf)
  >>> std_normal.scope()
  ['x1', 'x2']
  >>> std_normal.assignment([1, 1])
  0.058549831524319168
  >>> std_normal.marginalize(['x2'])
  >>> std_normal.scope()
  ['x1']
  >>> std_normal.assignment(1)
docstr_tok: ["Marginalize","the","factor","with","respect","to","the","given","variables",".","Parameters","--","--","--","--","--","variables",":","list",",","array-like","List","of","variables","with","respect","to","which","factor","is","to","be","maximized",".","inplace",":","boolean","If","inplace=True","it","will","modify","the","factor","itself",",","else","would","return","a","new","ContinuousFactor","instance",".","Returns","--","--","--","-","DiscreteFactor","or","None",":","if","inplace=True","(","default",")","returns","None","if","inplace=False","returns","a","new","ContinuousFactor","instance",".","Examples","--","--","--","--",">",">",">","from","pgmpy.factors.continuous","import","ContinuousFactor",">",">",">","from","scipy.stats","import","multivariate_normal",">",">",">","std_normal_pdf","=","lambda","*","x",":","multivariate_normal.pdf","(","x",",","[","0",",","0","]",",","[","[","1",",","0","]",",","[","0",",","1","]","]",")",">",">",">","std_normal","=","ContinuousFactor","(","[","'x1","'",",","'x2","'","]",",","std_normal_pdf",")",">",">",">","std_normal.scope","(",")","[","'x1","'",",","'x2","'","]",">",">",">","std_normal.assignment","(","[","1",",","1","]",")","0.058549831524319168",">",">",">","std_normal.marginalize","(","[","'x2","'","]",")",">",">",">","std_normal.scope","(",")","[","'x1","'","]",">",">",">","std_normal.assignment","(","1",")"]
code: def marginalize(self, variables, inplace=True):
      """
      Marginalize the factor with respect to the given variables.
  
      Parameters
      ----------
      variables: list, array-like
          List of variables with respect to which factor is to be maximized.
  
      inplace: boolean
          If inplace=True it will modify the factor itself, else would return
          a new ContinuousFactor instance.
  
      Returns
      -------
      DiscreteFactor or None: if inplace=True (default) returns None
                      if inplace=False returns a new ContinuousFactor instance.
  
      Examples
      --------
      >>> from pgmpy.factors.continuous import ContinuousFactor
      >>> from scipy.stats import multivariate_normal
      >>> std_normal_pdf = lambda *x: multivariate_normal.pdf(x, [0, 0], [[1, 0], [0, 1]])
      >>> std_normal = ContinuousFactor(['x1', 'x2'], std_normal_pdf)
      >>> std_normal.scope()
      ['x1', 'x2']
      >>> std_normal.assignment([1, 1])
      0.058549831524319168
      >>> std_normal.marginalize(['x2'])
      >>> std_normal.scope()
      ['x1']
      >>> std_normal.assignment(1)
  
      """
      phi = self if inplace else self.copy()
      phi.distribution = phi.distribution.marginalize(
          variables, inplace=False
      )
  
      if not inplace:
          return phi
  
imports: import types
  import numpy
  import scipy.integrate
  from pgmpy.factors.base import BaseFactor
  from pgmpy.factors.distributions import GaussianDistribution, CustomDistribution
label_desc: Use image node_id 10 for calling the ContinuousFactor obj's underlying member method code with example usage: obj.marginalize(variables, inplace) and returns: phi