aind_behavior_gym.dynamic_foraging.agent package¶
Submodules¶
aind_behavior_gym.dynamic_foraging.agent.base module¶
Generic agent class for dynamic foraging
- class aind_behavior_gym.dynamic_foraging.agent.base.DynamicForagingAgentBase(seed=None)[source]¶
Bases:
objectGeneric agent class for dynamic foraging
- act(observation)[source]¶
Chooses an action based on the current observation.
- Parameters:
observation – The current observation from the environment.
- Returns:
The action chosen by the agent.
- Return type:
action
- fit(data)[source]¶
Fit the parameters of the agent to data.
- Parameters:
data – Either from animal data (model fitting) or simulated data (model recovery)
- learn(observation, action, reward, next_observation, done)[source]¶
Updates the agent’s knowledge or policy based on the last action and its outcome.
This is the core method that should be implemented by all non-trivial agents. It could be Q-learning, policy gradients, neural networks, etc.
- Parameters:
observation – The observation before the action was taken.
action – The action taken by the agent.
reward – The reward received after taking the action.
next_observation – The next observation after the action.
done – Whether the episode has ended.
- load(filepath)[source]¶
Loads the agent’s state or learned parameters from a file.
- Parameters:
filepath (str) – The path to the file from which the agent’s state will be loaded.
- perform(task: DynamicForagingTaskBase)[source]¶
Perform one session (eposide) of the dynamic foraging task while learning.
aind_behavior_gym.dynamic_foraging.agent.random_agent module¶
A Random agent
- class aind_behavior_gym.dynamic_foraging.agent.random_agent.RandomAgent(seed=None)[source]¶
Bases:
DynamicForagingAgentBaseA Random agent
- class aind_behavior_gym.dynamic_foraging.agent.random_agent.RandomAgentBiasedIgnore(seed=None)[source]¶
Bases:
RandomAgentA biased agent with ignores
Module contents¶
Agent module