MeasureFairnessCompositeR Documentation

Composite Fairness Measure

Description

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

Public methods

Inherited 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 in measure.

measures

(list of MeasureFairness)
List of fairness measures to aggregate.

aggfun

(function())
Aggregation function used to aggregate results from respective measures. Defaults to sum.

operation

(function())
The operation used to compute the difference. A function that returns a single value given input: computed metric for each subgroup. Defaults to groupdiff_absdiff. See MeasureFairness for more information.

minimize

(logical(1))
Should the measure be minimized? Defaults to TRUE.

range

(numeric(2))
Range of the resulting measure. Defaults to c(-Inf, Inf).


Method clone()

The objects of this class are cloneable with this method.

Usage
MeasureFairnessComposite$clone(deep = FALSE)
Arguments
deep

Whether to make a deep clone.

Examples

library("mlr3")
# Equalized Odds Metric
MeasureFairnessComposite$new(measures = msrs(c("fairness.fpr", "fairness.tpr")))

# Other metrics e.g. based on negative rates
MeasureFairnessComposite$new(measures = msrs(c("fairness.fnr", "fairness.tnr")))