View source: R/fairness_radar.R
fairness_radar | R Documentation |
Make fairness_radar
object with chosen fairness_metrics
. Note that there must be at least three metrics that does not contain NA.
fairness_radar(x, fairness_metrics = c("ACC", "TPR", "PPV", "FPR", "STP"))
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 |
fairness_radar
object.
It is a list containing:
radar_data - data.frame
containing scores for each model and parity loss metric
label - model labels
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.