docstr: Normalizes the pdf of the distribution so that it
  integrates to 1 over all the variables.
  
  Parameters
  ----------
  inplace: boolean
      If inplace=True it will modify the distribution itself, else would return
      a new distribution.
  
  Returns
  -------
  CustomDistribution or None:
       if inplace=True (default) returns None
       if inplace=False returns a new CustomDistribution instance.
  
  Examples
  --------
  >>> from pgmpy.factors.distributions import CustomDistribution
  >>> from scipy.stats import multivariate_normal
  >>> normal_pdf_x2 = lambda x1, x2: 2 * multivariate_normal.pdf(
  ...                     x=[x1, x2], mean=[0, 0], cov=[[1, 0], [0, 1]])
  >>> normal_dist_x2 = CustomDistribution(variables=['x1', 'x2'],
  ...                                     distribution=normal_pdf_x2)
  >>> normal_dist_x2.assignment(1, 1)
  0.117099663049
  >>> normal_dist = normal_dist_x2.normalize(inplace=False)
  >>> normal_dist.assignment(1, 1)
  0.0585498315243
docstr_tok: ["Normalizes","the","pdf","of","the","distribution","so","that","it","integrates","to","1","over","all","the","variables",".","Parameters","--","--","--","--","--","inplace",":","boolean","If","inplace=True","it","will","modify","the","distribution","itself",",","else","would","return","a","new","distribution",".","Returns","--","--","--","-","CustomDistribution","or","None",":","if","inplace=True","(","default",")","returns","None","if","inplace=False","returns","a","new","CustomDistribution","instance",".","Examples","--","--","--","--",">",">",">","from","pgmpy.factors.distributions","import","CustomDistribution",">",">",">","from","scipy.stats","import","multivariate_normal",">",">",">","normal_pdf_x2","=","lambda","x1",",","x2",":","2","*","multivariate_normal.pdf","(","...","x=","[","x1",",","x2","]",",","mean=","[","0",",","0","]",",","cov=","[","[","1",",","0","]",",","[","0",",","1","]","]",")",">",">",">","normal_dist_x2","=","CustomDistribution","(","variables=","[","'x1","'",",","'x2","'","]",",","...","distribution=normal_pdf_x2",")",">",">",">","normal_dist_x2.assignment","(","1",",","1",")","0.117099663049",">",">",">","normal_dist","=","normal_dist_x2.normalize","(","inplace=False",")",">",">",">","normal_dist.assignment","(","1",",","1",")","0.0585498315243"]
code: def normalize(self, inplace=True):
      """
      Normalizes the pdf of the distribution so that it
      integrates to 1 over all the variables.
  
      Parameters
      ----------
      inplace: boolean
          If inplace=True it will modify the distribution itself, else would return
          a new distribution.
  
      Returns
      -------
      CustomDistribution or None:
           if inplace=True (default) returns None
           if inplace=False returns a new CustomDistribution instance.
  
      Examples
      --------
      >>> from pgmpy.factors.distributions import CustomDistribution
      >>> from scipy.stats import multivariate_normal
      >>> normal_pdf_x2 = lambda x1, x2: 2 * multivariate_normal.pdf(
      ...                     x=[x1, x2], mean=[0, 0], cov=[[1, 0], [0, 1]])
      >>> normal_dist_x2 = CustomDistribution(variables=['x1', 'x2'],
      ...                                     distribution=normal_pdf_x2)
      >>> normal_dist_x2.assignment(1, 1)
      0.117099663049
      >>> normal_dist = normal_dist_x2.normalize(inplace=False)
      >>> normal_dist.assignment(1, 1)
      0.0585498315243
      """
      phi = self if inplace else self.copy()
      pdf = self.pdf
  
      pdf_mod = integrate.nquad(
          pdf, [[-np.inf, np.inf] for var in self.variables]
      )[0]
  
      phi._pdf = lambda *args: pdf(*args) / pdf_mod
  
      if not inplace:
          return phi
  
imports: import numpy
  from scipy import integrate
  from pgmpy.factors.distributions import BaseDistribution
label_desc: Use image node_id 11 for calling the CustomDistribution obj's underlying member method code with example usage: obj.normalize(inplace) and returns: phi