predict.bandit: Predict Method for bandit objects

Description Usage Arguments Details Value

Description

Obtains predictions from a bandit object.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
predict.bandit_ucb(object,
                   whatSamples = "remaining",
                   whatModel = "last",
                   type = c("response", "uncertainty", "score"),
                   robust = TRUE)
predict.bandit_thompson(object,
                        whatSamples = "remaining",
                        whatModel = "last",
                        type = c("response","weight"),
                        re.form = NULL)

Arguments

object

an object inheriting from class "bandit"

whatSamples

the samples with which to predict. The default is all samples with a missing outcome. . Alternatives are "current", for all samples with a non-missing outcome; "last", for the samples used in the last training job; "job%i", for samples added in job "%i"; or a numeric vector of samples ids.

whatModel

the fitted model with which to predict. The default uses the last fitted model; alternatively, the job id of a training job can be supplied.

type

the type of prediction required. See Details.

robust

logical switch indicating whether generalized Moore-Penrose inverse should be used if regular inversion fails when computing uncertainty.

re.form

same as re.form in posterior_predict.stanreg.

Details

The predict method predictions using some model in the bandit. It is used to select the next experimental arm. For all methods, the type parameter may take values "link" and "response", for predictions on the scale of the linear predictors, and on the scale of the response variable respectively. Thus, for a default binomial model, type = "response" returns log-odds, while type = "link" returns predicted probabilities.

Objects of class "bandit_ucb" also support types "uncertainty", and "score". Uncertainty is used to compute the score, with score = response + alpha uncertainty.

Objects of class "bandit_thompson" also support type "weight", the Thompson sampling weights.

Value

If the type parameter has length 1, a vector of predictions. Otherwise, a data frame of predictions.


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