Skip to contents

Generates covariates and potential outcomes for a classification dataset.

Usage

generate_bandit_data(xs = NULL, y = NULL, noise_std = 1, signal_strength = 1)

Arguments

xs

Optional matrix. Covariates of shape [A, p], where A is the number of observations and p is the number of features. Default is NULL. Must not contain NA values.

y

Optional vector. Labels of length A. Default is NULL. Must not contain NA values.

noise_std

Numeric. Standard deviation of the noise added to the potential outcomes. Default is 1.0. Must be a non-negative number.

signal_strength

Numeric. Strength of the signal in the potential outcomes. Default is 1.0.

Value

A list containing the generated data (xs, ys, muxs, A, p, K) and the true class probabilities (mus).

Examples

data <- generate_bandit_data(xs = as.matrix(iris[,1:4]),
                             y = as.numeric(iris[,5]),
                             noise_std = 0.1,
                             signal_strength = 1.0)