bandit_ucb-class: An UCB bandit reference class (RC) object.

Description Usage Arguments Details Fields Methods See Also Examples

Description

An UCB bandit reference class (RC) object.

Usage

1
2
3
bandit_ucb(formula, data, family = c("gaussian", "binomial"),
           alpha = 1, contrasts = NULL, newLevels = FALSE,
           db = NULL, path = NULL)

Arguments

formula

an object of class "formula" (or one that can be coerced to that class): a symbolic description of the model that is fitted. The response must be named y

data

a data frame (or object coercible by as.data.frame to a data frame) containing the variables in the model. data must contain a column named id that uniquely identifies each observation, and a column named y that contains the model response.

family

a character string describing the error distribtion and link function to be used in the model. Can be either "binomial" or "gaussian" (the default).

alpha

the LinUCB tuning parameter. A positive scalar. Higher values of alpha favor exploration over exploitation.

contrasts

an optional list. See the contrasts.arg of model.matrix.default.

newLevels

a logical value indicating whether to allow for new factor levels when adding samples. Default is FALSE.

db

an optional named list of arguments passed to odbcDriverConnect.

path

an optional character string naming a folder open for writing.

Details

The RC class "bandit_ucb" inherits from class "bandit".

The introductory vignette provides a detailed explanation of LinUCB algorithms, and their implementation with banditr. See the Examples section.

Fields

alpha

the linear UCB tuning parameter. See details.

family

supported response type. See banditGlmnet for details.

Methods

train(parRidge = NULL, parLasso = NULL, seed = NULL) trains the model using banditGlmnet and all completed experiments. parRidge and parLasso are optional lists of parameters passed to banditGlmnet to control the fitting process. seed is an optional seeding value for the random number generator.

tune(param = 'lambdaRidge', value = 'auto', lambdaAuto = 'lambda.1se', parCvGlmnet = NULL, seed = NULL) set the value of a tuning parameter of the bandit. param is either 'lambdaRidge' (the default) or 'lambdaLasso'. Setting lambdaLasso > 0 enables a first stage of variable selection. value is either a scalar in [0,1] or 'auto'. If set to 'auto', the parameter is picked using cv.glmnet. lambdaAuto is either 'lambda.1se' or 'lambda.min' depending on which outcome of cv.glmnet should be selected. It is ignored if value is not 'auto'. parCvGlmnet is a list of parameters passed to cv.glmnet. This parameter is ignored if value is not 'auto'.

addSamples(df) add samples to the bandit. df is coercible to a data.frame, and can be appended to the data.frame used at creation. In particular, it contains an id column that is a primary key.

addOutcomes(y) add outcomes to the bandit. y is a named vector whose names are samples ids.

undo() cancel the last job.

See Also

bandit, bandit_thompson

Examples

1
vignette("introduction", "banditr")

rferrali/banditr documentation built on May 27, 2019, 5:56 a.m.