Description Usage Arguments Value Examples
This function is aimed to compute the probability of pulling each arm for various methods in Multi-Armed Bandit given the total reward and the number of trials for each arm.
1 2 3 | CalculateWeight(method = "Thompson-Sampling", method.par = list(ndraws.TS =
1000), all.event, reward.family, sd.reward = NULL, period = 1,
EXP3Info = NULL)
|
method |
A character string choosing from "Epsilon-Greedy",
"Epsilon-Decreasing", "Thompson-Sampling",
"EXP3", "UCB", "Bayes-Poisson-TS", "Greedy-Thompson-Sampling",
"EXP3-Thompson-Sampling",
"Greedy-Bayes-Poisson-TS" and "EXP3-Bayes-Poisson-TS".
See |
method.par |
A list of parameters needed for different methods:
|
all.event |
A data frame containing two columns |
reward.family |
A character string specifying the distribution family
of reward. Available distribution includes
"Bernoulli", "Poisson" and "Gaussian". If "Gaussian" is chosen to be the
reward distribution,
a vector of standard deviation should be provided in |
sd.reward |
A vector of non-negative numbers specifying standard
deviation of each arm's reward distribution if "Gaussian" is chosen to be
the reward distribution. Default to be NULL.
See |
period |
A positive integer specifying the period index. Default to be 1. |
EXP3Info |
A list of three vectors
See |
A normalized weight vector for future randomized allocation.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | ### Calculate weights using Thompson Sampling if reward follows Poisson
distribution.
set.seed(100)
CalculateWeight(method = "Thompson-Sampling",
method.par = list(ndraws.TS = 1000),
all.event = data.frame(reward = 1:3, trial = rep(10, 3)),
reward.family = "Poisson")
### Calculate weights using EXP3
CalculateWeight(method = "EXP3",
method.par = list(EXP3 = list(gamma = 0.01, eta =0.1)),
all.event = data.frame(reward = 1:3, trial = rep(10, 3)),
reward.family = "Bernoulli",
EXP3Info = list(prevWeight = rep(1, 3),
EXP3Trial = rep(5, 3),
EXP3Reward = 0:2))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.