class_docstr: PyMC model-fitting backend.
class_docstr_tok: ["PyMC","model-fitting","backend","."]
docstr: Add potentials to the PyMC model.
  
  Potentials are arbitrary quantities that are added to the model log likelihood.
  See 'Factor Potentials' in
  https://github.com/fonnesbeck/probabilistic_python/blob/main/pymc_intro.ipynb
  
  Parameters
  ----------
  spec : bambi.Model
      The model.
docstr_tok: ["Add","potentials","to","the","PyMC","model",".","Potentials","are","arbitrary","quantities","that","are","added","to","the","model","log","likelihood",".","See","'Factor","Potentials","'","in","https",":","\/\/github.com\/fonnesbeck\/probabilistic_python\/blob\/main\/pymc_intro.ipynb","Parameters","--","--","--","--","--","spec",":","bambi.Model","The","model","."]
code: def build_potentials(self, spec):
      """Add potentials to the PyMC model.
  
      Potentials are arbitrary quantities that are added to the model log likelihood.
      See 'Factor Potentials' in
      https://github.com/fonnesbeck/probabilistic_python/blob/main/pymc_intro.ipynb
  
      Parameters
      ----------
      spec : bambi.Model
          The model.
      """
      if spec.potentials is not None:
          count = 0
          for variable, constraint in spec.potentials:
              if isinstance(variable, (list, tuple)):
                  lambda_args = [self.model[var] for var in variable]
                  potential = constraint(*lambda_args)
              else:
                  potential = constraint(self.model[variable])
              pm.Potential(f"pot_{count}", potential)
              count += 1
  
imports: import functools
  import logging
  import traceback
  from copy import deepcopy
  from importlib.metadata import version
  import numpy
  import pymc
  import pytensor.tensor
  from pytensor.tensor.special import softmax
  from bambi.backend.links import cloglog, identity, inverse_squared, logit, probit, arctan_2
  from bambi.backend.model_components import ConstantComponent, DistributionalComponent
  from bambi.utils import get_aliased_name
label_desc: Use image node_id 5 for calling the PyMCModel obj's underlying member method code with example usage: obj.build_potentials(spec) without return types