| predict.fairadapt | R Documentation |
fairadapt objectPrediction function for new data from a saved fairadapt object
## S3 method for class 'fairadapt'
predict(object, newdata, ...)
object |
Object of class |
newdata |
A |
... |
Additional arguments forwarded to |
The newdata argument should be compatible with adapt.test
argument that was used when constructing the fairadapt object. In
particular, newdata should contain column names that appear in the formula
argument that was used when calling fairadapt() (apart from the outcome
variable on the LHS of the formula).
A data.frame containing the adapted version of the new data.
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 <- fairadapt(score ~ .,
train.data = head(uni_admission, n = n_samp),
adj.mat = uni_adj,
prot.attr = "gender"
)
predict(object = uni_ada, newdata = tail(uni_admission, n = n_samp))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.