View source: R/expand_fairness_object.R
expand_fairness_object | R Documentation |
Unfold fairness object to 3 columns (metrics, label, score) to construct better base for visualization.
expand_fairness_object( x, scale = FALSE, drop_metrics_with_na = FALSE, fairness_metrics = NULL )
x |
object of class |
scale |
logical, if |
drop_metrics_with_na |
logical, if |
fairness_metrics |
character, vector of fairness metrics names indicating from which expand. |
object of class expand_fairness_object
. It is a data.frame
with scores 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" ) expand_fairness_object(fobject, drop_metrics_with_na = TRUE) 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) expand_fairness_object(fobject, drop_metrics_with_na = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.