plot.fairness_regression_object | R Documentation |
Please note that this is experimental approach. Plot fairness check regression enables to look how big differences are between base subgroup (privileged) and unprivileged ones.
If bar plot reaches red zone it means that for this subgroup fairness goal is not satisfied. Multiple subgroups and models can be plotted.
Red and green zone boundary can be moved through epsilon parameter, that needs to be passed through fairness_check
.
## S3 method for class 'fairness_regression_object' plot(x, ...)
x |
|
... |
other plot parameters |
ggplot2
object
set.seed(123) data <- data.frame( x = c(rnorm(500, 500, 100), rnorm(500, 400, 200)), pop = c(rep("A", 500), rep("B", 500)) ) data$y <- rnorm(length(data$x), 1.5 * data$x, 100) # create model model <- lm(y ~ ., data = data) # create explainer exp <- DALEX::explain(model, data = data, y = data$y) # create fobject fobject <- fairness_check_regression(exp, protected = data$pop, privileged = "A") # results fobject plot(fobject) model_ranger <- ranger::ranger(y ~ ., data = data, seed = 123) exp2 <- DALEX::explain(model_ranger, data = data, y = data$y) fobject <- fairness_check_regression(exp2, fobject) # results fobject plot(fobject)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.