Computes a composite measure from multiple fairness metrics and aggregates them
using aggfun
(defaulting to mean()
).
Protected Attributes
The protected attribute is specified as a col_role
in the corresponding Task()
:<Task>$col_roles$pta = "name_of_attribute"
This also allows specifying more than one protected attribute,
in which case fairness will be considered on the level of intersecting groups defined by all columns
selected as a predicted attribute.
Super class
mlr3::Measure
-> MeasureFairnessComposite
Methods
Method new()
Creates a new instance of this R6 class.
Usage
MeasureFairnessComposite$new(
id = NULL,
measures,
aggfun = function(x) mean(x),
operation = groupdiff_absdiff,
minimize = TRUE,
range = c(-Inf, Inf)
)
Arguments
id
(
character(1)
)
Id of the measure. Defaults to the concatenation of ids inmeasure
.measures
(list of MeasureFairness)
List of fairness measures to aggregate.aggfun
(
function()
)
Aggregation function used to aggregate results from respective measures. Defaults tosum
.operation
(
function()
)
The operation used to compute the difference. A function that returns a single value given input: computed metric for each subgroup. Defaults togroupdiff_absdiff
. SeeMeasureFairness
for more information.minimize
(
logical(1)
)
Should the measure be minimized? Defaults toTRUE
.range
(
numeric(2)
)
Range of the resulting measure. Defaults toc(-Inf, Inf)
.
Examples
library("mlr3")
# Equalized Odds Metric
MeasureFairnessComposite$new(measures = msrs(c("fairness.fpr", "fairness.tpr")))
#> <MeasureFairnessComposite:fairness.fpr_tpr>
#> * Packages: mlr3, mlr3fairness
#> * Range: [-Inf, Inf]
#> * Minimize: TRUE
#> * Average: macro
#> * Parameters: list()
#> * Properties: requires_task
#> * Predict type: response
# Other metrics e.g. based on negative rates
MeasureFairnessComposite$new(measures = msrs(c("fairness.fnr", "fairness.tnr")))
#> <MeasureFairnessComposite:fairness.fnr_tnr>
#> * Packages: mlr3, mlr3fairness
#> * Range: [-Inf, Inf]
#> * Minimize: TRUE
#> * Average: macro
#> * Parameters: list()
#> * Properties: requires_task
#> * Predict type: response