View source: R/plot_fairmodels.R
plot_fairmodels | R Documentation |
Easier access to all plots in fairmodels. Provide plot type (that matches to function name), pass additional parameters and plot.
plot_fairmodels(x, type, ...) ## S3 method for class 'explainer' plot_fairmodels(x, type = "fairness_check", ..., protected, privileged) ## S3 method for class 'fairness_object' plot_fairmodels(x, type = "fairness_check", ...) ## Default S3 method: plot_fairmodels(x, type = "fairness_check", ...)
x |
object created with |
type |
character, type of plot. Should match function name in fairmodels. Default is fairness_check. |
... |
other parameters passed to fairmodels functions. |
protected |
factor, vector containing sensitive attributes such as gender, race, etc... |
privileged |
character/factor, level in factor denoting privileged subgroup |
types (function names) available:
fairness_check
stack_metrics
fairness_heatmap
fairness_pca
fairness_radar
group_metric
choose_metric
metric_scores
performance_and_fairness
all_cutoffs
ceteris_paribus_cutoff
ggplot2
object
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) # works with explainer when protected and privileged are passed plot_fairmodels(explainer_lm, type = "fairness_radar", protected = german$Sex, privileged = "male" ) # or with fairness_object fobject <- fairness_check(explainer_lm, protected = german$Sex, privileged = "male" ) plot_fairmodels(fobject, type = "fairness_radar")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.