update_thompson {banditsCI} | R Documentation |
Update linear Thompson Sampling model.
Description
Updates the parameters of a linear Thompson Sampling model for multi-armed bandit problems based on new observations.
Usage
update_thompson(ws, yobs, model, xs = NULL, ps = NULL, balanced = NULL)
Arguments
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 |
Value
A list containing the updated parameters of the LinTSModel.
Examples
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)