View source: R/experiment_utils.R
run_experiment | R Documentation |
Runs a LinTS or non-contextual TS bandit experiment, given potential outcomes and covariates.
run_experiment(
ys,
floor_start,
floor_decay,
batch_sizes,
xs = NULL,
balanced = NULL
)
ys |
Matrix. Potential outcomes of shape |
floor_start |
Numeric. Specifies the initial value for the assignment probability floor. It ensures that at the start of the process, no assignment probability falls below this threshold. Must be a positive number. |
floor_decay |
Numeric. Decay rate of the floor. The floor decays with the number of observations in the experiment such that at each point in time, the applied floor is: |
batch_sizes |
Integer vector. Size of each batch. Must be positive integers. |
xs |
Optional matrix. Covariates of shape |
balanced |
Optional logical. Indicates whether to balance the batches. Default is |
A list containing the pulled arms (ws
), observed rewards (yobs
), assignment probabilities (probs
), and the fitted bandit model (fitted_bandit_model
).
set.seed(123)
A <- 1000
K <- 4
xs <- matrix(runif(A * K), nrow = A, ncol = K)
ys <- matrix(rbinom(A * K, 1, 0.5), nrow = A, ncol = K)
batch_sizes <- c(250, 250, 250, 250)
results <- run_experiment(ys = ys,
floor_start = 1/K,
floor_decay = 0.9,
batch_sizes = batch_sizes,
xs = xs)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.