Skip to contents

Instantiates one new measure per protected attribute group in a task. Each metric is then evaluated only on predictions made for the given specific subgroup.

Usage

groupwise_metrics(base_measure, task, intersect = TRUE)

Arguments

base_measure

(Measure())
The base metric evaluated within each subgroup.

task

Task
mlr3::Task() to instantiate measures for.

intersect

logical
Should multiple pta groups be intersected? Defaults to TRUE. Only relevant if more than one pta columns are provided.

Value

list
List of mlr3::Measures.

See also

Examples

  library("mlr3")
  t = tsk("compas")
  l = lrn("classif.rpart")
  m = groupwise_metrics(msr("classif.acc"), t)
  l$train(t)$predict(t)$score(m, t)
#>   subgroup.acc_Male subgroup.acc_Female 
#>           0.9681809           0.9812766