How to do it...

Let's create an environment that represents our problem of cliff walking:

  1. Let's start by loading the cliff walking environment using the makeEnvironment() function:
env = makeEnvironment("cliff.walking")env

The following screenshot shows the description of the cliff walking environment:

  1. Next, we create a function that will query the environment with random actions and get the observational sequence data:
# Creating the function to query the environmentsequences <- function(iter,env){ actions <- env$actions data <- data.frame(matrix(ncol = 4, nrow = 0)) colnames(data) <- c("State", "Action", "Reward","NextState") env$reset() ...

Get Deep Learning with R Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.