class_docstr: Initialize an instance of UAI writer class
  
  Parameters
  ----------
  model: A Bayesian or Markov model
      The model to write
  
  round_values: int (default: None)
      The number to decimals to which to round the probability values. If None, keeps all decimals points.
  
  Examples
  --------
  >>> from pgmpy.readwrite import UAIWriter
  >>> from pgmpy.utils import get_example_model
  >>> model = get_example_model('asia')
  >>> writer = UAIWriter(asia)
  >>> writer.write_uai('asia.uai')
docstr: Adds functions to the network.
  
  Examples
  -------_
  >>> from pgmpy.readwrite import UAIWriter
  >>> writer = UAIWriter(model)
  >>> writer.get_functions()
docstr_tok: ["Adds","functions","to","the","network",".","Examples","--","--","--","-_",">",">",">","from","pgmpy.readwrite","import","UAIWriter",">",">",">","writer","=","UAIWriter","(","model",")",">",">",">","writer.get_functions","(",")"]
code: def get_functions(self):
      """
      Adds functions to the network.
  
      Examples
      -------_
      >>> from pgmpy.readwrite import UAIWriter
      >>> writer = UAIWriter(model)
      >>> writer.get_functions()
      """
      if isinstance(self.model, BayesianNetwork):
          cpds = self.model.get_cpds()
          cpds.sort(key=lambda x: x.variable)
          variables = sorted(
              self.domain.items(), key=lambda x: (x[1], x[0])
          )
          functions = []
          for cpd in cpds:
              child_var = cpd.variable
              evidence = cpd.variables[:0:-1]
              function = [
                  str(variables.index((var, self.domain[var])))
                  for var in evidence
              ]
              function.append(
                  str(
                      variables.index(
                          (child_var, self.domain[child_var])
                      )
                  )
              )
              functions.append(function)
          return functions
      elif isinstance(self.model, MarkovNetwork):
          factors = self.model.get_factors()
          functions = []
          variables = sorted(
              self.domain.items(), key=lambda x: (x[1], x[0])
          )
          for factor in factors:
              scope = factor.scope()
              function = [
                  str(variables.index((var, self.domain[var])))
                  for var in scope
              ]
              functions.append(function)
          return functions
      else:
          raise TypeError(
              "Model must be an instance of Markov or Bayesian model."
          )
  
imports: from itertools import combinations
  import numpy
  from pyparsing import Combine, Literal, Optional, Regex, Word, alphas, nums
  from pgmpy.factors.discrete import DiscreteFactor, TabularCPD
  from pgmpy.models import BayesianNetwork, MarkovNetwork
  from pgmpy.utils import compat_fns
label_desc: Use image node_id 5 for calling the UAIWriter obj's underlying member method code with example usage: obj.get_functions() and returns: functions, functions