mlpy.agents.modules.LearningModule

class mlpy.agents.modules.LearningModule(learner_type, *args, **kwargs)[source]

Bases: mlpy.agents.modules.IAgentModule

Learning agent module.

The learning agent module allows the agent to learn from passed experiences.

Parameters:

learner_type : str

The learning type. Based on the type the appropriate learner module is created. Valid learning types are:

qlearner

The learner performs q-learning, a reinforcement learning variant (QLearner).

modelbasedlearner

The model based learner performs reinforcement learning using the provided planner and model (ModelBasedLearner).

apprenticeshiplearner

The learner performs apprenticeship learning via inverse reinforcement learning, a method introduced by Abbeel and Ng which strives to imitate the demonstrations given by an expert (ApprenticeshipLearner).

incrapprenticeshiplearner

The learner incrementally performs apprenticeship learning via inverse reinforcement learning. Inverse reinforcement learning assumes knowledge of the underlying model. However, this is not always feasible. The incremental apprenticeship learner updates its model after every iteration by executing the current policy (IncrApprenticeshipLearner).

args : tuple, optional

Positional parameters passed to the learner for initialization. See the appropriate learner type for more information. Default is None.

kwargs : dict, optional

Non-positional parameters passed to the learner for initialization. See the appropriate learner type for more information. Default is None.

Attributes

mid The module’s unique identifier.

Methods

choose_action(state) Choose the next action.
cleanup() Cleanup the agent module.
end(experience) End the episode.
init() Initialize the learning agent module.
is_complete() Check if the agent module has completed.
load(filename) Load the state of the module from file.
save(filename) Save the current state of the module to file.
start() “Start an episode.
step(experience) Execute the learner.
terminate(value) Set the termination flag.