stack_metrics | R Documentation |
Stack metrics sums parity loss metrics for all models. Higher value of stacked metrics means the model is less fair (has higher bias) for subgroups from protected vector.
stack_metrics(x, fairness_metrics = c("ACC", "TPR", "PPV", "FPR", "STP"))
x |
object of class |
fairness_metrics |
character, vector of fairness parity_loss metric names to include in plot. Full names are provided in |
stacked_metrics
object. It contains data.frame
with information about score for each metric and model.
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" ) sm <- stack_metrics(fobject) plot(sm) rf_model <- ranger::ranger(Risk ~ ., data = german, probability = TRUE, num.trees = 200 ) explainer_rf <- DALEX::explain(rf_model, data = german[, -1], y = y_numeric) fobject <- fairness_check(explainer_rf, fobject) sm <- stack_metrics(fobject) plot(sm)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.