| MeasureFairnessConstraint | R Documentation |
This measure allows constructing for 'constraint' measures of the following form:
min performance subject to fairness < \epsilon
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.
mlr3::Measure -> MeasureFairnessConstraint
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.
new()Creates a new instance of this R6 class.
MeasureFairnessConstraint$new( id = NULL, performance_measure, fairness_measure, epsilon = 0.01, range = c(-Inf, Inf) )
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).
clone()The objects of this class are cloneable with this method.
MeasureFairnessConstraint$clone(deep = FALSE)
deepWhether to make a deep clone.
mlr_measures_fairness
# 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.