class_docstr: The Agent class, the highest-level API that wraps together processes for action, perception, and learning under active inference.
  
  The basic usage is as follows:
  
  >>> my_agent = Agent(A = A, B = C, <more_params>)
  >>> observation = env.step(initial_action)
  >>> qs = my_agent.infer_states(observation)
  >>> q_pi, G = my_agent.infer_policies()
  >>> next_action = my_agent.sample_action()
  >>> next_observation = env.step(next_action)
  
  This represents one timestep of an active inference process. Wrapping this step in a loop with an ``Env()`` class that returns
  observations and takes actions as inputs, would entail a dynamic agent-environment interaction.
class_docstr_tok: ["The","Agent","class",",","the","highest-level","API","that","wraps","together","processes","for","action",",","perception",",","and","learning","under","active","inference",".","The","basic","usage","is","as","follows",":",">",">",">","my_agent","=","Agent","(","A","=","A",",","B","=","C",",","<","more_params",">",")",">",">",">","observation","=","env.step","(","initial_action",")",">",">",">","qs","=","my_agent.infer_states","(","observation",")",">",">",">","q_pi",",","G","=","my_agent.infer_policies","(",")",">",">",">","next_action","=","my_agent.sample_action","(",")",">",">",">","next_observation","=","env.step","(","next_action",")","This","represents","one","timestep","of","an","active","inference","process",".","Wrapping","this","step","in","a","loop","with","an","``","Env","(",")","``","class","that","returns","observations","and","takes","actions","as","inputs",",","would","entail","a","dynamic","agent-environment","interaction","."]
docstr: Update approximate posterior beliefs about Dirichlet parameters that parameterise the observation likelihood or ``A`` array.
  
  Parameters
  ----------
  observation: ``list`` or ``tuple`` of ints
      The observation input. Each entry ``observation[m]`` stores the index of the discrete
      observation for modality ``m``.
  
  Returns
  -----------
  qA: ``numpy.ndarray`` of dtype object
      Posterior Dirichlet parameters over observation model (same shape as ``A``), after having updated it with observations.
docstr_tok: ["Update","approximate","posterior","beliefs","about","Dirichlet","parameters","that","parameterise","the","observation","likelihood","or","``","A","``","array",".","Parameters","--","--","--","--","--","observation",":","``","list","``","or","``","tuple","``","of","ints","The","observation","input",".","Each","entry","``","observation","[","m","]","``","stores","the","index","of","the","discrete","observation","for","modality","``","m","``",".","Returns","--","--","--","--","--","-","qA",":","``","numpy.ndarray","``","of","dtype","object","Posterior","Dirichlet","parameters","over","observation","model","(","same","shape","as","``","A","``",")",",","after","having","updated","it","with","observations","."]
code: def update_A(self, obs):
      """
      Update approximate posterior beliefs about Dirichlet parameters that parameterise the observation likelihood or ``A`` array.
  
      Parameters
      ----------
      observation: ``list`` or ``tuple`` of ints
          The observation input. Each entry ``observation[m]`` stores the index of the discrete
          observation for modality ``m``.
  
      Returns
      -----------
      qA: ``numpy.ndarray`` of dtype object
          Posterior Dirichlet parameters over observation model (same shape as ``A``), after having updated it with observations.
      """
  
      qA = learning.update_obs_likelihood_dirichlet(
          self.pA,
          self.A,
          obs,
          self.qs,
          self.lr_pA,
          self.modalities_to_learn,
      )
  
      self.pA = qA  # set new prior to posterior
      self.A = utils.norm_dist_obj_arr(
          qA
      )  # take expected value of posterior Dirichlet parameters to calculate posterior over A array
  
      return qA
  
imports: import warnings
  import numpy
  from pymdp import inference, control, learning
  from pymdp import utils, maths
  import copy
label_desc: Use image node_id 16 for calling the Agent obj's underlying member method code with example usage: obj.update_A(obs) and returns: qA