kcv = fairml.cv(response = vu.test$gaussian, predictors = vu.test$X,
sensitive = vu.test$S, unfairness = 0.10, model = "nclm",
method = "k-fold", k = 10, runs = 10)
kcv
cv.loss(kcv)
cv.unfairness(kcv)
# run a second cross-validation with the same folds.
fairml.cv(response = vu.test$gaussian, predictors = vu.test$X,
sensitive = vu.test$S, unfairness = 0.10, model = "nclm",
method = "custom-folds", folds = cv.folds(kcv))
# run cross-validation in parallel.
if (FALSE) {
library(parallel)
cl = makeCluster(2)
fairml.cv(response = vu.test$gaussian, predictors = vu.test$X,
sensitive = vu.test$S, unfairness = 0.10, model = "nclm",
method = "k-fold", k = 5, runs = 5, cluster = cl)
stopCluster(cl)
}
Run the code above in your browser using DataLab