choicerule: Apply a choice rule (action selection rule) to probabilistic...

Description Usage Arguments Value References Examples

View source: R/choicerule.R

Description

Apply a choice rule (action selection rule) to probabilistic predictions.

Usage

1
2
3
4
5
6
choicerule(
  x,
  type = c("softmax", "luce", "argmax", "epsilon"),
  tolerance = sqrt(.Machine$double.eps),
  ...
)

Arguments

x

A numeric vector or matrix with probabilistic predictions for actions. If x is a vector, binary actions are assumed. If x is a matrix, column 1 holds predictions for action 1, column 2 for action 2, etc. 0 <= x <= 1 is required.

type

The choice rule (action selection rule), can be one of c("luce", "argmax", "softmax", "epsilon"), abbreviations are allowed. luce is Luce's choice rule, argmax is an arg max choice rule, softmax is a soft maximum, epsilon is an epsilon-greedy rule assuming a constant error

tolerance

**optional** A small number. Usually all rows in the predictions need to sum up to 1 if predictions contain more than 1 column. A tolerance allows the rows to sum up to 1 - tolerance, should be small.

...

Other parameters to be passed to the choice rule methods: softmax needs a parameter tau, epsilon needs a parameter eps.

Value

A matrix holding the probability to select each action in the columns.

References

See the individual functions.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
# Some predictions
predictions <- cbind(A = c(.1,.5,.4), B = c(.3,.1,.4), C = c(.6, .4, .2))
# Apply various choice rules

choicerule(predictions, "luce")
choicerule(predictions, "argmax")
choicerule(predictions, "epsilon", eps = .2)

# Some binary predictions
binaryPredictions <- c(.22, .5, .73)
# Apply a choice rule
choicerule(binaryPredictions, "softmax", tau = 2)

JanaJarecki/cognitiveutils documentation built on Sept. 9, 2020, 9:11 a.m.