plot.group_metric | R Documentation |
Plot chosen metric in group. Notice how models are treating different subgroups.
Compare models both in fairness metrics and in performance. Parity loss can be enabled when creating group_metric
object.
## S3 method for class 'group_metric' plot(x, ...)
x |
object of class group_metric |
... |
other group_metric objects and other parameters |
list of ggplot2
objects
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" ) gm <- group_metric(fobject, "TPR", "f1", parity_loss = TRUE) plot(gm) 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) gm <- group_metric(fobject, "TPR", "f1", parity_loss = TRUE) plot(gm)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.