Description Usage Arguments Value References Examples
View source: R/ReinforcementLearning.R
Performs model-free reinforcement learning. Requires input data in the form of sample sequences consisting of states, actions and rewards. The result of the learning process is a state-action table and an optimal policy that defines the best possible action in each state.
1 2 3 4 |
data |
A dataframe containing the input sequences for reinforcement learning.
Each row represents a state transition tuple |
s |
A string defining the column name of the current state in |
a |
A string defining the column name of the selected action for the current state in |
r |
A string defining the column name of the reward in the current state in |
s_new |
A string defining the column name of the next state in |
learningRule |
A string defining the selected reinforcement learning agent. The default value and
only option in the current package version is |
iter |
(optional) Iterations to be done. iter is an integer greater than 0. By default, |
control |
(optional) Control parameters defining the behavior of the agent.
Default: |
verbose |
If true, progress report is shown. Default: |
model |
(optional) Existing model of class |
... |
Additional parameters passed to function. |
An object of class rl with the following components:
QResulting state-action table.
Q_hashResulting state-action table in hash format.
ActionsSet of actions.
StatesSet of states.
PolicyResulting policy defining the best possible action in each state.
RewardSequenceRewards collected during each learning episode in iter.
RewardTotal reward collected during the last learning iteration in iter.
Sutton and Barto (1998). Reinforcement Learning: An Introduction, Adaptive Computation and Machine Learning, MIT Press, Cambridge, MA.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | # Sampling data (1000 grid sequences)
data <- sampleGridSequence(1000)
# Setting reinforcement learning parameters
control <- list(alpha = 0.1, gamma = 0.1, epsilon = 0.1)
# Performing reinforcement learning
model <- ReinforcementLearning(data, s = "State", a = "Action", r = "Reward",
s_new = "NextState", control = control)
# Printing model
print(model)
# Plotting learning curve
plot(model)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.