View source: R/experiment_utils.R
update_thompson | R Documentation |
Updates the parameters of a linear Thompson Sampling model for multi-armed bandit problems based on new observations.
update_thompson(ws, yobs, model, xs = NULL, ps = NULL, balanced = NULL)
ws |
Integer vector. Indicates which arm was chosen for observations at each time |
yobs |
Numeric vector. Observed outcomes, length |
model |
List. Contains the parameters of the LinTSModel. |
xs |
Optional matrix. Covariates of shape |
ps |
Optional matrix. Probabilities of selecting each arm for each observation, if the LinTSModel is balanced. Default is |
balanced |
Logical. Indicates whether to use balanced Thompson Sampling. Default is |
A list containing the updated parameters of the LinTSModel.
set.seed(123)
model <- LinTSModel(K = 5, p = 3, floor_start = 1, floor_decay = 0.9, num_mc = 100,
is_contextual = TRUE)
A <- 1000
ws <- numeric(A)
yobs <- numeric(A)
model <- update_thompson(ws = ws, yobs = yobs, model = model)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.