draw_thompson function

Thompson Sampling draws.

Thompson Sampling draws.

Draws arms from a LinTS or non-contextual TS agent for multi-armed bandit problems.

draw_thompson(model, start, end, xs = NULL)

Arguments

  • model: List. Contains the parameters of the model, generated by LinTSModel().
  • start: Integer. Starting index of observations for which arms are to be drawn. Must be a positive integer.
  • end: Integer. Ending index of the observations for which arms are to be drawn. Must be an integer greater than or equal to start.
  • xs: Optional matrix. Covariates of shape [A, p], where p is the number of features, if the LinTSModel is contextual. Default is NULL. Must not contain NA values.

Returns

A list containing the drawn arms (w) and their corresponding probabilities (ps).

Examples

set.seed(123) model <- LinTSModel(K = 5, p = 3, floor_start = 1/5, floor_decay = 0.9, num_mc = 100, is_contextual = TRUE) draws <- draw_thompson(model = model, start = 1, end = 10, xs = matrix(rnorm(30), ncol = 3))