class_docstr: A Linear Gaussian Bayesian Network is a Bayesian Network, all
  of whose variables are continuous, and where all of the CPDs
  are linear Gaussians.
  
  An important result is that the linear Gaussian Bayesian Networks
  are an alternative representation for the class of multivariate
  Gaussian distributions.
class_docstr_tok: ["A","Linear","Gaussian","Bayesian","Network","is","a","Bayesian","Network",",","all","of","whose","variables","are","continuous",",","and","where","all","of","the","CPDs","are","linear","Gaussians",".","An","important","result","is","that","the","linear","Gaussian","Bayesian","Networks","are","an","alternative","representation","for","the","class","of","multivariate","Gaussian","distributions","."]
docstr: Add linear Gaussian CPD (Conditional Probability Distribution)
  to the Bayesian Network.
  
  Parameters
  ----------
  cpds  :  instances of LinearGaussianCPD
      List of LinearGaussianCPDs which will be associated with the model
  
  Examples
  --------
  >>> from pgmpy.models import LinearGaussianBayesianNetwork
  >>> from pgmpy.factors.continuous import LinearGaussianCPD
  >>> model = LinearGaussianBayesianNetwork([('x1', 'x2'), ('x2', 'x3')])
  >>> cpd1 = LinearGaussianCPD('x1', [1], 4)
  >>> cpd2 = LinearGaussianCPD('x2', [-5, 0.5], 4, ['x1'])
  >>> cpd3 = LinearGaussianCPD('x3', [4, -1], 3, ['x2'])
  >>> model.add_cpds(cpd1, cpd2, cpd3)
  >>> for cpd in model.cpds:
  ...     print(cpd)
  
  P(x1) = N(1; 4)
  P(x2| x1) = N(0.5*x1_mu); -5)
  P(x3| x2) = N(-1*x2_mu); 4)
docstr_tok: ["Add","linear","Gaussian","CPD","(","Conditional","Probability","Distribution",")","to","the","Bayesian","Network",".","Parameters","--","--","--","--","--","cpds",":","instances","of","LinearGaussianCPD","List","of","LinearGaussianCPDs","which","will","be","associated","with","the","model","Examples","--","--","--","--",">",">",">","from","pgmpy.models","import","LinearGaussianBayesianNetwork",">",">",">","from","pgmpy.factors.continuous","import","LinearGaussianCPD",">",">",">","model","=","LinearGaussianBayesianNetwork","(","[","(","'x1","'",",","'x2","'",")",",","(","'x2","'",",","'x3","'",")","]",")",">",">",">","cpd1","=","LinearGaussianCPD","(","'x1","'",",","[","1","]",",","4",")",">",">",">","cpd2","=","LinearGaussianCPD","(","'x2","'",",","[","-5",",","0.5","]",",","4",",","[","'x1","'","]",")",">",">",">","cpd3","=","LinearGaussianCPD","(","'x3","'",",","[","4",",","-1","]",",","3",",","[","'x2","'","]",")",">",">",">","model.add_cpds","(","cpd1",",","cpd2",",","cpd3",")",">",">",">","for","cpd","in","model.cpds",":","...","print","(","cpd",")","P","(","x1",")","=","N","(","1",";","4",")","P","(","x2|","x1",")","=","N","(","0.5","*","x1_mu",")",";","-5",")","P","(","x3|","x2",")","=","N","(","-1","*","x2_mu",")",";","4",")"]
code: def add_cpds(self, *cpds):
      """
      Add linear Gaussian CPD (Conditional Probability Distribution)
      to the Bayesian Network.
  
      Parameters
      ----------
      cpds  :  instances of LinearGaussianCPD
          List of LinearGaussianCPDs which will be associated with the model
  
      Examples
      --------
      >>> from pgmpy.models import LinearGaussianBayesianNetwork
      >>> from pgmpy.factors.continuous import LinearGaussianCPD
      >>> model = LinearGaussianBayesianNetwork([('x1', 'x2'), ('x2', 'x3')])
      >>> cpd1 = LinearGaussianCPD('x1', [1], 4)
      >>> cpd2 = LinearGaussianCPD('x2', [-5, 0.5], 4, ['x1'])
      >>> cpd3 = LinearGaussianCPD('x3', [4, -1], 3, ['x2'])
      >>> model.add_cpds(cpd1, cpd2, cpd3)
      >>> for cpd in model.cpds:
      ...     print(cpd)
  
      P(x1) = N(1; 4)
      P(x2| x1) = N(0.5*x1_mu); -5)
      P(x3| x2) = N(-1*x2_mu); 4)
  
      """
      for cpd in cpds:
          if not isinstance(cpd, LinearGaussianCPD):
              raise ValueError("Only LinearGaussianCPD can be added.")
  
          if set(cpd.variables) - set(cpd.variables).intersection(
              set(self.nodes())
          ):
              raise ValueError(
                  "CPD defined on variable not in the model", cpd
              )
  
          for prev_cpd_index in range(len(self.cpds)):
              if self.cpds[prev_cpd_index].variable == cpd.variable:
                  logger.warning(
                      f"Replacing existing CPD for {cpd.variable}"
                  )
                  self.cpds[prev_cpd_index] = cpd
                  break
          else:
              self.cpds.append(cpd)
  
file_path: pgmpy/pgmpy/models/LinearGaussianBayesianNetwork.py
imports: import networkx
  import numpy
  from pgmpy.factors.continuous import LinearGaussianCPD
  from pgmpy.factors.distributions import GaussianDistribution
  from pgmpy.global_vars import logger
  from pgmpy.models import BayesianNetwork
label_desc: Use image node_id 1 for calling the LinearGaussianBayesianNetwork obj's underlying member method code with example usage: obj.add_cpds() without return types