Skip to contents

Step 4

fitting.MLE <- multiRL::fit_p(
  estimate = "MLE",

  data = data,
  behrule = behrule,
  colnames = colnames,

  models = list(multiRL::TD, multiRL::RSTD, multiRL::Utility),
  settings = list(name = c("TD", "RSTD", "Utility")),
  
  algorithm = "NLOPT_GN_MLSL",
  lowers = list(c(0, 0), c(0, 0, 0), c(0, 0, 0)),
  uppers = list(c(1, 5), c(1, 1, 5), c(1, 5, 1)),
  control = list(core = 10, iter = 100)
)

save(fitting.MLE, file = "./fitting.MLE.Rdata")

Estimate Methods

With minimal configuration, users can estimate optimal parameters using four distinct methods. In the following code snippets, I only highlight the arguments that vary by estimation method. Unless explicitly noted, other arguments can be duplicated from the above example.

# How to use MLE as estimate method
fitting.MLE <- multiRL::fit_p(
  estimate = "MLE",
  control = list(
    core = 10, sample = 100, iter = 100
  ),
  ...
)
# How to use MAP as estimate method
fitting.MAP <- multiRL::fit_p(
  estimate = "MAP",
  control = list(
    core = 10, sample = 100, iter = 100,
    diff = 0.001, patience = 10
  ),
  ...
)
# How to use ABC as estimate method
fitting.ABC <- multiRL::fit_p(
  estimate = "ABC",
  control = list(
    core = 10, sample = 100, train = 1000,
    tol = 0.1
  ),
  ...
)

# How to use RNN as estimate method
reticulate::use_condaenv(condaenv = "your_tensorflow_env_name", required = TRUE)

fitting.RNN <- multiRL::fit_p(
  estimate = "RNN",
  control = list(
    core = 1, sample = 100, train = 1000,
    layer = "GRU", units = 128, batch_size = 10, epochs = 100
  ),
  ...
)