fairness_radar {fairmodels} | R Documentation |
Fairness radar
Description
Make fairness_radar
object with chosen fairness_metrics
. Note that there must be at least three metrics that does not contain NA.
Usage
fairness_radar(x, fairness_metrics = c("ACC", "TPR", "PPV", "FPR", "STP"))
Arguments
x |
object of class |
fairness_metrics |
character, vector of metric names, at least 3 metrics without NA needed. Full names of metrics can be found in |
Value
fairness_radar
object.
It is a list containing:
radar_data -
data.frame
containing scores for each model and parity loss metriclabel - model labels
Examples
data("german")
y_numeric <- as.numeric(german$Risk) - 1
lm_model <- glm(Risk ~ .,
data = german,
family = binomial(link = "logit")
)
explainer_lm <- DALEX::explain(lm_model, data = german[, -1], y = y_numeric)
fobject <- fairness_check(explainer_lm,
protected = german$Sex,
privileged = "male"
)
fradar <- fairness_radar(fobject, fairness_metrics = c(
"ACC", "STP", "TNR",
"TPR", "PPV"
))
plot(fradar)
rf_model <- ranger::ranger(Risk ~ .,
data = german,
probability = TRUE,
num.trees = 200,
num.threads = 1
)
explainer_rf <- DALEX::explain(rf_model, data = german[, -1], y = y_numeric)
fobject <- fairness_check(explainer_rf, fobject)
fradar <- fairness_radar(fobject, fairness_metrics = c(
"ACC",
"STP",
"TNR",
"TPR",
"PPV"
))
plot(fradar)
[Package fairmodels version 1.2.1 Index]