fairadaptBoot {fairadapt} | R Documentation |
Fairadapt Boostrap wrapper
Description
The fairadapt()
function performs data adaptation, but does so only
once. Sometimes, it might be desirable to repeat this process, in order to be
able to make uncertainty estimates about the data adaptation that is
performed. The wrapper function fairadaptBoot()
enables the user to do
so, by performing the fairadapt()
procedure multiple times, and
keeping in memory the important multiple data transformations. For a worked
example of how to use fairadaptBoot()
for uncertainty quantification,
see the fairadapt
vignette.
Usage
fairadaptBoot(
formula,
prot.attr,
adj.mat,
train.data,
test.data = NULL,
cfd.mat = NULL,
top.ord = NULL,
res.vars = NULL,
quant.method = rangerQuants,
keep.object = FALSE,
n.boot = 100,
rand.mode = c("finsamp", "quant", "both"),
test.seed = 2022,
...
)
Arguments
formula |
Object of class |
prot.attr |
A value of class |
adj.mat |
Matrix of class |
train.data , test.data |
Training data & testing data, both of class
|
cfd.mat |
Symmetric matrix of class |
top.ord |
A vector of class |
res.vars |
A vector of class |
quant.method |
A function choosing the method used for quantile
regression. Default value is |
keep.object |
a |
n.boot |
An integer corresponding to the umber of bootstrap iterations. |
rand.mode |
A string, taking values |
test.seed |
a seed for the randomness in breaking quantiles for the
discrete variables. This argument is only relevant when |
... |
Additional arguments forwarded to the function passed as
|
Value
An object of class fairadaptBoot
, containing the original and
adapted training and testing data, together with the causal graph and some
additional meta-information.
References
Plecko, D. & Meinshausen, N. (2019). Fair Data Adaptation with Quantile Preservation
Examples
n_samp <- 200
uni_dim <- c( "gender", "edu", "test", "score")
uni_adj <- matrix(c( 0, 1, 1, 0,
0, 0, 1, 1,
0, 0, 0, 1,
0, 0, 0, 0),
ncol = length(uni_dim),
dimnames = rep(list(uni_dim), 2),
byrow = TRUE)
uni_ada <- fairadaptBoot(score ~ .,
train.data = head(uni_admission, n = n_samp),
test.data = tail(uni_admission, n = n_samp),
adj.mat = uni_adj,
prot.attr = "gender",
n.boot = 5
)
uni_ada