agents – RL Components: Agents

class pybrain.rl.agents.agent.Agent

An agent is an entity capable of producing actions, based on previous observations. Generally it will also learn from experience. It can interact directly with a Task.

getAction()
Return a chosen action. :rtype: by default, this is assumed to ba a numpy array of doubles. :note: This method is abstract and needs to be implemented.
giveReward(r)
Reward or punish the agent. :key r: reward, if C{r} is positive, punishment if C{r} is negative :type r: double
integrateObservation(obs)
Integrate the current observation of the environment. :arg obs: The last observation returned from the environment :type obs: by default, this is assumed to be a numpy array of doubles
newEpisode()
Inform the agent that a new episode has started.
class pybrain.rl.agents.logging.LoggingAgent(indim, outdim)

Bases: pybrain.rl.agents.agent.Agent

This agent stores actions, states, and rewards encountered during interaction with an environment in a ReinforcementDataSet (which is a variation of SequentialDataSet). The stored history can be used for learning and is erased by resetting the agent. It also makes sure that integrateObservation, getAction and giveReward are called in exactly that order.

getAction()
Step 2: store the action in a temporary variable until reward is given.
giveReward(r)
Step 3: store observation, action and reward in the history dataset.
integrateObservation(obs)
Step 1: store the observation received in a temporary variable until action is called and reward is given.
newEpisode()
Indicate the beginning of a new episode in the training cycle.
reset()
Clear the history of the agent.
class pybrain.rl.agents.LearningAgent(module, learner=None)

Bases: pybrain.rl.agents.logging.LoggingAgent

LearningAgent has a module, a learner, that modifies the module, and an explorer, which perturbs the actions. It can have learning enabled or disabled and can be used continuously or with episodes.

getAction()
Activate the module with the last observation, adda the exploration from the explorer object and store the result as last action.
learn(episodes=1)
Call the learner’s learn method, which has access to both module and history.
learning
Return whether the agent currently learns from experience or not.
newEpisode()
Indicate the beginning of a new episode in the training cycle.
reset()
Clear the history of the agent and resets the module and learner.
class pybrain.rl.agents.OptimizationAgent(module, learner)

Bases: pybrain.rl.agents.agent.Agent

A simple wrapper to allow optimizers to conform to the RL interface. Works only in conjunction with EpisodicExperiment.

Previous topic

actionvalues – RL Components: ActionValues

Next topic

experiments – RL Components: Experiments

This Page