mlpy.learners.online.rl.QLearner

class mlpy.learners.online.rl.QLearner(explorer=None, alpha=None, gamma=None, filename=None)[source]

Bases: mlpy.learners.online.IOnlineLearner

Performs q-learning.

Q-learning is a reinforcement learning variant.

Parameters:

explorer : Explorer, optional

The exploration strategy used. Default is no exploration.

alpha : float, optional

The learning rate. Default is 0.5.

gamma : float, optional

The discounting factor. Default is 0.9.

filename : str, optional

The name of the file to save the learner state to after each iteration. If None is given, the learner state is not saved. Default is None.

Attributes

mid The module’s unique identifier.
type

Methods

choose_action(state) Choose the next action
end(experience) End the episode.
init() Initialize the learner.
learn(experience) Learn a policy from the experience.
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 learning specific updates.