Learn R Programming

fairmodels (version 1.1.0)

plot_density: Plot fairness object

Description

Plot distribution for models output probabilities. See how being in particular subgroup affects models decision.

Usage

plot_density(x, ...)

Arguments

x

object of class fairness_object

...

other plot parameters

Value

ggplot2 object

Examples

Run this code
# NOT RUN {
data("compas")

glm_compas <- glm(Two_yr_Recidivism~., data=compas, family=binomial(link="logit"))

y_numeric <- as.numeric(compas$Two_yr_Recidivism)-1

explainer_glm <- DALEX::explain(glm_compas, data = compas, y = y_numeric)

fobject <-  fairness_check(explainer_glm,
                             protected = compas$Ethnicity,
                             privileged = "Caucasian")

plot_density(fobject)
# }

Run the code above in your browser using DataLab