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: Resets the posterior beliefs about hidden states of the agent to a uniform distribution, and resets time to first timestep of the simulation's temporal horizon.
  Returns the posterior beliefs about hidden states.
  
  Returns
  ---------
  qs: ``numpy.ndarray`` of dtype object
     Initialized posterior over hidden states. Depending on the inference algorithm chosen and other parameters (such as the parameters stored within ``edge_handling_paramss),
     the resulting ``qs`` variable will have additional sub-structure to reflect whether beliefs are additionally conditioned on timepoint and policy.
      For example, in case the ``self.inference_algo == 'MMP' `, the indexing structure of ``qs`` is policy->timepoint-->factor, so that 
      ``qs[p_idx][t_idx][f_idx]`` refers to beliefs about marginal factor ``f_idx`` expected under policy ``p_idx`` 
      at timepoint ``t_idx``. In this case, the returned ``qs`` will only have entries filled out for the first timestep, i.e. for ``q[p_idx][0]``, for all 
      policy-indices ``p_idx``. Subsequent entries ``q[:][1, 2, ...]`` will be initialized to empty ``numpy.ndarray`` objects.
docstr_tok: ["Resets","the","posterior","beliefs","about","hidden","states","of","the","agent","to","a","uniform","distribution",",","and","resets","time","to","first","timestep","of","the","simulation","'s","temporal","horizon",".","Returns","the","posterior","beliefs","about","hidden","states",".","Returns","--","--","--","--","-","qs",":","``","numpy.ndarray","``","of","dtype","object","Initialized","posterior","over","hidden","states",".","Depending","on","the","inference","algorithm","chosen","and","other","parameters","(","such","as","the","parameters","stored","within","``","edge_handling_paramss",")",",","the","resulting","``","qs","``","variable","will","have","additional","sub-structure","to","reflect","whether","beliefs","are","additionally","conditioned","on","timepoint","and","policy",".","For","example",",","in","case","the","``","self.inference_algo","==","'MMP","'","`",",","the","indexing","structure","of","``","qs","``","is","policy-",">","timepoint","--",">","factor",",","so","that","``","qs","[","p_idx","]","[","t_idx","]","[","f_idx","]","``","refers","to","beliefs","about","marginal","factor","``","f_idx","``","expected","under","policy","``","p_idx","``","at","timepoint","``","t_idx","``",".","In","this","case",",","the","returned","``","qs","``","will","only","have","entries","filled","out","for","the","first","timestep",",","i.e",".","for","``","q","[","p_idx","]","[","0","]","``",",","for","all","policy-indices","``","p_idx","``",".","Subsequent","entries","``","q","[",":","]","[","1",",","2",",","...","]","``","will","be","initialized","to","empty","``","numpy.ndarray","``","objects","."]
code: def reset(self, init_qs=None):
      """
      Resets the posterior beliefs about hidden states of the agent to a uniform distribution, and resets time to first timestep of the simulation's temporal horizon.
      Returns the posterior beliefs about hidden states.
  
      Returns
      ---------
      qs: ``numpy.ndarray`` of dtype object
         Initialized posterior over hidden states. Depending on the inference algorithm chosen and other parameters (such as the parameters stored within ``edge_handling_paramss),
         the resulting ``qs`` variable will have additional sub-structure to reflect whether beliefs are additionally conditioned on timepoint and policy.
          For example, in case the ``self.inference_algo == 'MMP' `, the indexing structure of ``qs`` is policy->timepoint-->factor, so that
          ``qs[p_idx][t_idx][f_idx]`` refers to beliefs about marginal factor ``f_idx`` expected under policy ``p_idx``
          at timepoint ``t_idx``. In this case, the returned ``qs`` will only have entries filled out for the first timestep, i.e. for ``q[p_idx][0]``, for all
          policy-indices ``p_idx``. Subsequent entries ``q[:][1, 2, ...]`` will be initialized to empty ``numpy.ndarray`` objects.
      """
  
      self.curr_timestep = 0
  
      if init_qs is None:
          if self.inference_algo == "VANILLA":
              self.qs = utils.obj_array_uniform(self.num_states)
          else:  # in the case you're doing MMP (i.e. you have an inference_horizon > 1), we have to account for policy- and timestep-conditioned posterior beliefs
              self.qs = utils.obj_array(len(self.policies))
              for p_i, _ in enumerate(self.policies):
                  self.qs[p_i] = utils.obj_array(
                      self.inference_horizon + self.policy_len + 1
                  )  # + 1 to include belief about current timestep
                  self.qs[p_i][0] = utils.obj_array_uniform(
                      self.num_states
                  )
  
              first_belief = utils.obj_array(len(self.policies))
              for p_i, _ in enumerate(self.policies):
                  first_belief[p_i] = copy.deepcopy(self.D)
  
              if self.edge_handling_params["policy_sep_prior"]:
                  self.set_latest_beliefs(last_belief=first_belief)
              else:
                  self.set_latest_beliefs(last_belief=self.D)
  
      else:
          self.qs = init_qs
  
      return self.qs
  
imports: import warnings
  import numpy
  from pymdp import inference, control, learning
  from pymdp import utils, maths
  import copy
label_desc: Use image node_id 7 for calling the Agent obj's underlying member method code with example usage: obj.reset(init_qs) and returns: self