mlpy.learners.online.rl.QLearner

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

Bases: mlpy.learners.online.rl.RLLearner

Performs q-learning.

Q-learning is a reinforcement learning variant.

Parameters:

explorer : Explorer, optional

The exploration strategy used. Default is no exploration.

max_steps : int, optional

The maximum number of steps in an iteration. Default is 100

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.

profile : bool, optional

Turn on profiling at which point profiling data is collected and saved to a text file. Default is False.

Attributes

mid The module’s unique identifier.
type This learner is of type online.

Methods

choose_action(state) Choose the next action
execute(experience) Execute learning specific updates.
learn([experience]) Learn a policy from the experience.
load(filename) Load the state of the module from file.
reset(t, **kwargs) Reset reinforcement learner.
save(filename) Save the learners state.