Documentation ¶
Overview ¶
The rlearning package contains code for reinforcement learning algorithms and other related functions needed to run them.
As of now, the list of functionality supported is Q-Learning and the DecayExploration policy.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Agent ¶
type Agent interface { SetPolicy(policyType string, args []float64) Train(info bool) (bool, error) Test(info bool) }
Agent is a representation for reinforcement learning agents with setting a learning policy, training function, and testing function.
type DecayExplorationPolicy ¶
DecayExplorationPolicy implements the Policy interface to represent a decayed exploration policy for reinforcement learning.
func (*DecayExplorationPolicy) SelectAction ¶
func (policy *DecayExplorationPolicy) SelectAction( mode string, values *mat.Dense, args []float64, ) float64
SelectAction returns an action given a state from `args`.
func (*DecayExplorationPolicy) Update ¶
func (policy *DecayExplorationPolicy) Update()
Update updates the `EXPLORATION_RATE` using the `EXPLORATION_DECAY` value.
type Policy ¶
type Policy interface { SelectAction(mode string, values *mat.Dense, args []float64) float64 Update() }
Policy is a representation for reinforcement learning policies with a function to select an action given values and a mode type. An update function is needed to update any policy parameters.
type QAgent ¶
type QAgent struct { ENV *env.Environment MAX_EPISODES int MAX_ACTIONS int LEARNING_RATE float64 DISCOUNT float64 POLICY *Policy // contains filtered or unexported fields }
QAgent implements the Agent interface for a Q-Learning agent. It contains the max iterations for training, max actions in each iteration, learning rate, discount rate, the learning policy, and table of Q values.
func NewQAgent ¶
func NewQAgent( env *env.Environment, max_eps int, max_acts int, learning_rate float64, discount float64, ) QAgent
NewQAgent returns a new QAgent instance given the environment and other parameters.