devtools::install_github("smilesun/rlR")
or
devtools::install_github("smilesun/rlR", dependencies = TRUE)
rlR use keras with tensorflow as its backend for neural network as functional approximator and OpenAI gym.
library(rlR)
## - type 'reticulate::py_discover_config()' to check default python
## - to use a different python path, execute the following after package is loaded:
## reticulate::use_python('/path/to/your/python')
env = makeGymEnv("CartPole-v0")
env
##
## action cnt: 2
## state original dim: 4
## discrete action
If you have R package “imager” installed, you could get a snapshot of the environment by
env$snapshot(preprocess = F)
agent = initAgent("AgentDQN", env)
agent$learn(200L)