View source: R/experiment_utils.R
calculate_balwts | R Documentation |
Calculates the inverse probability score of pulling arms, given the actions taken and the true probabilities of each arm being chosen.
calculate_balwts(ws, probs)
ws |
Integer vector. Indicates which arm was chosen for observations at each time |
probs |
Numeric matrix or array. True probabilities of each arm being chosen at each time step. Shape |
A matrix or array containing the inverse probability score of pulling arms.
set.seed(123)
A <- 5
K <- 3
ws <- sample(1:K, A, replace = TRUE)
probs <- matrix(runif(A * K), nrow = A, ncol = K)
balwts <- calculate_balwts(ws, probs)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.