library(rlR) set.seed(123) knitr::opts_chunk$set(cache = TRUE, collapse = FALSE, dev = "svg", fig.height = 3.5) knitr::knit_hooks$set(document = function(x){ gsub("```\n*```r*\n*", "", x) }) library(reticulate) os = import("os") os$environ[["TF_CPP_MIN_LOG_LEVEL"]]="3"
If you want to use this package for your self defined task, you need to implement your own R6 class to represent the environment which must inherit the rlR::Environment
Class. You could define other public and private members as you like which do not collide with the names in rlR::Environment
. Type the following to have a look at the documentation of rlR::Environment
help(topic="Environment", package = "rlR")
env = rlR:::EnvToy$new()
rlR:::EnvToy
is an R6 class which inherit rlR::Environment
.
class(env)
There are 3 methods you must override when defining your own Environment class.
env$initialize # the fields 'act_cnt' and 'state_dim' must be defined here
env$reset # The return must be a list with fields state(must be an array), reward = NULL, done = FALSE, and info = list()
env$step # The return must be a list with fields state(must be an array), reward(numeric), done(Boolean), and info (list of anything or empty list)
Afterwards you could choose one of the available Agents to check if the newly defined environments works.
agent = initAgent("AgentDQN", env) agent$learn(3)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.