Learn R Programming

mlr3fairness (version 0.4.0)

MeasureFairnessConstraint: Fairness Constraint Measure

Description

This measure allows constructing for 'constraint' measures of the following form:
$$min performance subject to fairness < \epsilon$$

Arguments

Protected Attributes

The protected attribute is specified as a col_role in the corresponding mlr3::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 -> MeasureFairnessConstraint

Public fields

performance_measure

(Measure())
The performance measure to be used.

fairness_measure

(Measure())
The fairness measure to be used.

epsilon

(numeric)
Deviation from perfect fairness that is allowed.

Methods

Inherited methods


Method new()

Creates a new instance of this R6 class.

Usage

MeasureFairnessConstraint$new(
  id = NULL,
  performance_measure,
  fairness_measure,
  epsilon = 0.01,
  range = c(-Inf, Inf)
)

Arguments

id

(character)
The measure's id. Set to 'fairness.<base_measure_id>' if ommited.

performance_measure

(Measure())
The measure used to measure performance (e.g. accuracy).

fairness_measure

(Measure())
The measure used to measure fairness (e.g. equalized odds).

epsilon

(numeric)
Allowed divergence from perfect fairness. Initialized to 0.01.

range

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


Method clone()

The objects of this class are cloneable with this method.

Usage

MeasureFairnessConstraint$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.

See Also

mlr_measures_fairness

Examples

Run this code
# Accuracy subject to equalized odds fairness constraint:
library("mlr3")
t = tsk("adult_train")
learner = lrn("classif.rpart", cp = .01)
learner$train(t)
measure = msr("fairness.constraint", id = "acc_tpr", msr("classif.acc"), msr("fairness.tpr"))
predictions = learner$predict(t)
predictions$score(measure, task = t)

Run the code above in your browser using DataLab