diff --git a/DESCRIPTION b/DESCRIPTION index 8b4bb5b6..bceb9390 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Type: Package Package: mlr3fairness Title: Fairness Auditing and Debiasing for 'mlr3' -Version: 0.4.0 +Version: 0.4.1 Authors@R: c( person("Florian", "Pfisterer", , "pfistererf@googlemail.com", role = c("cre", "aut"), comment = c(ORCID = "0000-0001-8867-762X")), @@ -15,7 +15,7 @@ Description: Integrates fairness auditing and bias mitigation methods for "Reweighing" described in 'Kamiran, Calders' (2012) and "Equalized Odds" described in 'Hardt et al.' (2016) - . + . Integration with 'mlr3' allows for auditing of ML models as well as convenient joint tuning of machine learning algorithms and debiasing methods. @@ -61,4 +61,4 @@ Config/testthat/parallel: false Encoding: UTF-8 LazyData: true Roxygen: list(markdown = TRUE) -RoxygenNote: 7.3.2 +RoxygenNote: 7.3.3 diff --git a/NEWS.md b/NEWS.md index 17e17992..a67e35a1 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,4 +1,4 @@ -# mlr3fairness (development version) +# mlr3fairness 0.4.1 * Register `MeasureFairness`, `MeasureFairnessComposite`, `MeasureFairnessConstraint` and `MeasureSubgroup` with prototype arguments so `as.data.table(mlr_measures)` no longer errors. diff --git a/R/bibentries.R b/R/bibentries.R index 0aef4b42..3754c690 100644 --- a/R/bibentries.R +++ b/R/bibentries.R @@ -11,7 +11,7 @@ bibentries = c( hardt_2016 = bibentry("inproceedings", author = "Moritz Hardt and Eric Price and Nathan Srebro", title = "Equality of Opportunity in Supervised Learning", - url = "https://papers.nips.cc/paper/2016/file/9d2682367c3935defcb1f9e247a97c0d-Paper.pdf", + url = "https://doi.org/10.48550/arXiv.1610.02413", booktitle = "Advances in Neural Information Processing Systems", volume = "29", year = "2016", diff --git a/README.md b/README.md index 529458dd..2dbf814c 100644 --- a/README.md +++ b/README.md @@ -280,5 +280,4 @@ questions, suggestions or feedback, please do not hesitate to open an often helpful if you provide a “minimum working example” that showcases the behaviour. -[^1]: The fairness report is inspired by the [Aequitas Bias - report](http://aequitas.dssg.io/example.html). +[^1]: The fairness report is inspired by the Aequitas Bias report. diff --git a/man/MeasureFairness.Rd b/man/MeasureFairness.Rd index 721bfa59..19e8e3ab 100644 --- a/man/MeasureFairness.Rd +++ b/man/MeasureFairness.Rd @@ -27,7 +27,7 @@ selected as a predicted attribute. } \examples{ -\dontshow{if (rlang::is_installed("rpart")) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} +\dontshow{if (rlang::is_installed("rpart")) withAutoprint(\{ # examplesIf} library("mlr3") # Create MeasureFairness to measure the Predictive Parity. t = tsk("adult_train") @@ -65,11 +65,12 @@ a single value. Defaults to \code{abs(x - y)}.} } } \if{html}{\out{ -
Inherited methods +
Inherited methods diff --git a/man/MeasureFairnessComposite.Rd b/man/MeasureFairnessComposite.Rd index eb8aac49..ec57efe4 100644 --- a/man/MeasureFairnessComposite.Rd +++ b/man/MeasureFairnessComposite.Rd @@ -35,11 +35,12 @@ MeasureFairnessComposite$new(measures = msrs(c("fairness.fnr", "fairness.tnr"))) } } \if{html}{\out{ -
Inherited methods +
Inherited methods diff --git a/man/MeasureFairnessConstraint.Rd b/man/MeasureFairnessConstraint.Rd index c2d1e1b5..86592bfb 100644 --- a/man/MeasureFairnessConstraint.Rd +++ b/man/MeasureFairnessConstraint.Rd @@ -17,7 +17,7 @@ selected as a predicted attribute. } \examples{ -\dontshow{if (rlang::is_installed("rpart")) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} +\dontshow{if (rlang::is_installed("rpart")) withAutoprint(\{ # examplesIf} # Accuracy subject to equalized odds fairness constraint: library("mlr3") t = tsk("adult_train") @@ -56,11 +56,12 @@ Deviation from perfect fairness that is allowed.} } } \if{html}{\out{ -
Inherited methods +
Inherited methods diff --git a/man/MeasureSubgroup.Rd b/man/MeasureSubgroup.Rd index 9b000381..57a9888b 100644 --- a/man/MeasureSubgroup.Rd +++ b/man/MeasureSubgroup.Rd @@ -7,7 +7,7 @@ Allows for calculation of arbitrary \code{\link[mlr3:Measure]{mlr3::Measure()}}s on a selected sub-group. } \examples{ -\dontshow{if (rlang::is_installed("rpart")) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} +\dontshow{if (rlang::is_installed("rpart")) withAutoprint(\{ # examplesIf} library("mlr3") # Create MeasureFairness to measure the Predictive Parity. t = tsk("adult_train") @@ -47,11 +47,12 @@ Should groups be intersected?} } } \if{html}{\out{ -
Inherited methods +
Inherited methods diff --git a/man/compute_metrics.Rd b/man/compute_metrics.Rd index 75aa1707..222c57dd 100644 --- a/man/compute_metrics.Rd +++ b/man/compute_metrics.Rd @@ -32,7 +32,7 @@ selected as a predicted attribute. } \examples{ -\dontshow{if (rlang::is_installed("rpart")) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} +\dontshow{if (rlang::is_installed("rpart")) withAutoprint(\{ # examplesIf} library("mlr3") # Get adult data as a data.table train = tsk("adult_train")$data() diff --git a/man/fairness_accuracy_tradeoff.Rd b/man/fairness_accuracy_tradeoff.Rd index 79767918..64dc2333 100644 --- a/man/fairness_accuracy_tradeoff.Rd +++ b/man/fairness_accuracy_tradeoff.Rd @@ -54,7 +54,7 @@ selected as a predicted attribute. } \examples{ -\dontshow{if (rlang::is_installed("rpart") && rlang::is_installed("ranger")) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} +\dontshow{if (rlang::is_installed("rpart") && rlang::is_installed("ranger")) withAutoprint(\{ # examplesIf} library("mlr3") library("mlr3learners") library("ggplot2") diff --git a/man/fairness_compare_metrics.Rd b/man/fairness_compare_metrics.Rd index 93bfea52..7315d6c9 100644 --- a/man/fairness_compare_metrics.Rd +++ b/man/fairness_compare_metrics.Rd @@ -47,7 +47,7 @@ selected as a predicted attribute. } \examples{ -\dontshow{if (rlang::is_installed("rpart") && rlang::is_installed("ranger")) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} +\dontshow{if (rlang::is_installed("rpart") && rlang::is_installed("ranger")) withAutoprint(\{ # examplesIf} library("mlr3") library("mlr3learners") diff --git a/man/fairness_prediction_density.Rd b/man/fairness_prediction_density.Rd index 97bea169..0a545498 100644 --- a/man/fairness_prediction_density.Rd +++ b/man/fairness_prediction_density.Rd @@ -38,7 +38,7 @@ selected as a predicted attribute. } \examples{ -\dontshow{if (rlang::is_installed("rpart")) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} +\dontshow{if (rlang::is_installed("rpart")) withAutoprint(\{ # examplesIf} library("mlr3") library("mlr3learners") diff --git a/man/fairness_tensor.Rd b/man/fairness_tensor.Rd index 7bbfd46b..7d3fbf7c 100644 --- a/man/fairness_tensor.Rd +++ b/man/fairness_tensor.Rd @@ -48,7 +48,7 @@ selected as a predicted attribute. } \examples{ -\dontshow{if (rlang::is_installed("rpart")) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} +\dontshow{if (rlang::is_installed("rpart")) withAutoprint(\{ # examplesIf} library("mlr3") task = tsk("compas") prediction = lrn("classif.rpart")$train(task)$predict(task) diff --git a/man/groupwise_metrics.Rd b/man/groupwise_metrics.Rd index 05b5a1c6..249a07b8 100644 --- a/man/groupwise_metrics.Rd +++ b/man/groupwise_metrics.Rd @@ -26,7 +26,7 @@ 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. } \examples{ -\dontshow{if (rlang::is_installed("rpart")) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} +\dontshow{if (rlang::is_installed("rpart")) withAutoprint(\{ # examplesIf} library("mlr3") t = tsk("compas") l = lrn("classif.rpart") diff --git a/man/mlr3fairness-package.Rd b/man/mlr3fairness-package.Rd index 752c3911..6ebc850b 100644 --- a/man/mlr3fairness-package.Rd +++ b/man/mlr3fairness-package.Rd @@ -6,7 +6,7 @@ \alias{mlr3fairness-package} \title{mlr3fairness: Fairness Auditing and Debiasing for 'mlr3'} \description{ -Integrates fairness auditing and bias mitigation methods for the 'mlr3' ecosystem. This includes fairness metrics, reporting tools, visualizations and bias mitigation techniques such as "Reweighing" described in 'Kamiran, Calders' (2012) \doi{10.1007/s10115-011-0463-8} and "Equalized Odds" described in 'Hardt et al.' (2016) \url{https://papers.nips.cc/paper/2016/file/9d2682367c3935defcb1f9e247a97c0d-Paper.pdf}. Integration with 'mlr3' allows for auditing of ML models as well as convenient joint tuning of machine learning algorithms and debiasing methods. +Integrates fairness auditing and bias mitigation methods for the 'mlr3' ecosystem. This includes fairness metrics, reporting tools, visualizations and bias mitigation techniques such as "Reweighing" described in 'Kamiran, Calders' (2012) \doi{10.1007/s10115-011-0463-8} and "Equalized Odds" described in 'Hardt et al.' (2016) \url{https://doi.org/10.48550/arXiv.1610.02413}. Integration with 'mlr3' allows for auditing of ML models as well as convenient joint tuning of machine learning algorithms and debiasing methods. } \seealso{ Useful links: diff --git a/man/mlr_learners_classif.fairfgrrm.Rd b/man/mlr_learners_classif.fairfgrrm.Rd index 4f2a90f8..1c515da8 100644 --- a/man/mlr_learners_classif.fairfgrrm.Rd +++ b/man/mlr_learners_classif.fairfgrrm.Rd @@ -44,7 +44,7 @@ lrn("classif.fairfgrrm") } \examples{ -\dontshow{if (rlang::is_installed("fairml")) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} +\dontshow{if (rlang::is_installed("fairml")) withAutoprint(\{ # examplesIf} library("mlr3") # stop example failing with warning if package not installed learner = suppressWarnings(mlr3::lrn("classif.fairfgrrm")) @@ -98,6 +98,7 @@ pfistfl
  • mlr3::Learner$reset()
  • mlr3::Learner$selected_features()
  • mlr3::Learner$train()
  • +
  • mlr3::LearnerClassif$predict_newdata_fast()
  • }} diff --git a/man/mlr_learners_classif.fairzlrm.Rd b/man/mlr_learners_classif.fairzlrm.Rd index 96f9fd30..a5dc1af8 100644 --- a/man/mlr_learners_classif.fairzlrm.Rd +++ b/man/mlr_learners_classif.fairzlrm.Rd @@ -41,7 +41,7 @@ lrn("classif.fairzlrm") } \examples{ -\dontshow{if (rlang::is_installed("fairml")) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} +\dontshow{if (rlang::is_installed("fairml")) withAutoprint(\{ # examplesIf} library("mlr3") # stop example failing with warning if package not installed learner = suppressWarnings(mlr3::lrn("classif.fairzlrm")) @@ -95,6 +95,7 @@ pfistfl
  • mlr3::Learner$reset()
  • mlr3::Learner$selected_features()
  • mlr3::Learner$train()
  • +
  • mlr3::LearnerClassif$predict_newdata_fast()
  • }} diff --git a/man/mlr_learners_fairness.Rd b/man/mlr_learners_fairness.Rd index cdd461c0..000056fb 100644 --- a/man/mlr_learners_fairness.Rd +++ b/man/mlr_learners_fairness.Rd @@ -40,7 +40,7 @@ selected as a predicted attribute. } \examples{ -\dontshow{if (rlang::is_installed("fairml")) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} +\dontshow{if (rlang::is_installed("fairml")) withAutoprint(\{ # examplesIf} # example code library("mlr3") diff --git a/man/mlr_learners_regr.fairfrrm.Rd b/man/mlr_learners_regr.fairfrrm.Rd index d346962c..3bf7d9f2 100644 --- a/man/mlr_learners_regr.fairfrrm.Rd +++ b/man/mlr_learners_regr.fairfrrm.Rd @@ -47,7 +47,7 @@ lrn("regr.fairfrrm") } \examples{ -\dontshow{if (rlang::is_installed("fairml")) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} +\dontshow{if (rlang::is_installed("fairml")) withAutoprint(\{ # examplesIf} library("mlr3") # stop example failing with warning if package not installed learner = suppressWarnings(mlr3::lrn("regr.fairfrrm")) @@ -101,6 +101,7 @@ pfistfl
  • mlr3::Learner$reset()
  • mlr3::Learner$selected_features()
  • mlr3::Learner$train()
  • +
  • mlr3::LearnerRegr$predict_newdata_fast()
  • }} diff --git a/man/mlr_learners_regr.fairnclm.Rd b/man/mlr_learners_regr.fairnclm.Rd index 69a49b87..3160cfd7 100644 --- a/man/mlr_learners_regr.fairnclm.Rd +++ b/man/mlr_learners_regr.fairnclm.Rd @@ -43,7 +43,7 @@ lrn("regr.fairnclm") } \examples{ -\dontshow{if (rlang::is_installed("fairml")) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} +\dontshow{if (rlang::is_installed("fairml")) withAutoprint(\{ # examplesIf} library("mlr3") # stop example failing with warning if package not installed learner = suppressWarnings(mlr3::lrn("regr.fairnclm")) @@ -97,6 +97,7 @@ pfistfl
  • mlr3::Learner$reset()
  • mlr3::Learner$selected_features()
  • mlr3::Learner$train()
  • +
  • mlr3::LearnerRegr$predict_newdata_fast()
  • }} diff --git a/man/mlr_learners_regr.fairzlm.Rd b/man/mlr_learners_regr.fairzlm.Rd index 75ffef9e..c3f62471 100644 --- a/man/mlr_learners_regr.fairzlm.Rd +++ b/man/mlr_learners_regr.fairzlm.Rd @@ -41,7 +41,7 @@ lrn("regr.fairzlm") } \examples{ -\dontshow{if (rlang::is_installed("fairml")) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} +\dontshow{if (rlang::is_installed("fairml")) withAutoprint(\{ # examplesIf} library("mlr3") # stop example failing with warning if package not installed learner = suppressWarnings(mlr3::lrn("regr.fairzlm")) @@ -95,6 +95,7 @@ pfistfl
  • mlr3::Learner$reset()
  • mlr3::Learner$selected_features()
  • mlr3::Learner$train()
  • +
  • mlr3::LearnerRegr$predict_newdata_fast()
  • }} diff --git a/man/mlr_measures_positive_probability.Rd b/man/mlr_measures_positive_probability.Rd index b3e5bd4f..3b6216ee 100644 --- a/man/mlr_measures_positive_probability.Rd +++ b/man/mlr_measures_positive_probability.Rd @@ -9,7 +9,7 @@ Return the probabiliy of a positive prediction, often known as 'Calders-Wevers' This is defined as count of positive predictions divided by the number of observations. } \examples{ -\dontshow{if (rlang::is_installed("rpart")) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} +\dontshow{if (rlang::is_installed("rpart")) withAutoprint(\{ # examplesIf} library("mlr3") # Create Positive Probability Measure t = tsk("adult_train") @@ -31,11 +31,12 @@ predictions$score(measure, task = t) } } \if{html}{\out{ -
    Inherited methods +
    Inherited methods diff --git a/man/mlr_pipeops_equalized_odds.Rd b/man/mlr_pipeops_equalized_odds.Rd index 0feda19e..bb5a9ffe 100644 --- a/man/mlr_pipeops_equalized_odds.Rd +++ b/man/mlr_pipeops_equalized_odds.Rd @@ -60,7 +60,7 @@ Methods inherited from \link[mlr3pipelines:PipeOpTaskPreproc]{mlr3pipelines::Pip } \examples{ -\dontshow{if (rlang::is_installed("rpart")) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} +\dontshow{if (rlang::is_installed("rpart")) withAutoprint(\{ # examplesIf} library("mlr3") library("mlr3pipelines") @@ -86,7 +86,7 @@ glrn$predict_newdata(task$data(cols = task$feature_names)) Hardt M, Price E, Srebro N (2016). \dQuote{Equality of Opportunity in Supervised Learning.} In \emph{Advances in Neural Information Processing Systems}, volume 29, 3315--3323. -\url{https://papers.nips.cc/paper/2016/file/9d2682367c3935defcb1f9e247a97c0d-Paper.pdf}. +\url{https://doi.org/10.48550/arXiv.1610.02413}. Pleiss, Geoff, Raghavan, Manish, Wu, Felix, Kleinberg, Jon, Weinberger, Q K (2017). \dQuote{On Fairness and Calibration.} diff --git a/man/mlr_pipeops_reweighing.Rd b/man/mlr_pipeops_reweighing.Rd index 53377acc..97ce9ef1 100644 --- a/man/mlr_pipeops_reweighing.Rd +++ b/man/mlr_pipeops_reweighing.Rd @@ -80,7 +80,7 @@ Methods inherited from \link[mlr3pipelines:PipeOpTaskPreproc]{mlr3pipelines::Pip } \examples{ -\dontshow{if (rlang::is_installed("rpart")) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} +\dontshow{if (rlang::is_installed("rpart")) withAutoprint(\{ # examplesIf} library("mlr3") library("mlr3pipelines") diff --git a/man/report_datasheet.Rd b/man/report_datasheet.Rd index 2bb056a7..96f48252 100644 --- a/man/report_datasheet.Rd +++ b/man/report_datasheet.Rd @@ -25,7 +25,7 @@ Uses the awesome markdown template created by Chris Garbin \href{https://github.com/fau-masters-collected-works-cgarbin/model-card-template}{from Github}. } \examples{ -\dontshow{if (rlang::is_installed("rmarkdown")) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} +\dontshow{if (rlang::is_installed("rmarkdown")) withAutoprint(\{ # examplesIf} report_file = tempfile() report_datasheet(report_file) \dontshow{\}) # examplesIf} diff --git a/man/report_fairness.Rd b/man/report_fairness.Rd index 31074d09..626953ec 100644 --- a/man/report_fairness.Rd +++ b/man/report_fairness.Rd @@ -43,7 +43,7 @@ Uses the awesome markdown template created by Chris Garbin \href{https://github.com/fau-masters-collected-works-cgarbin/model-card-template}{from Github}. } \examples{ -\dontshow{if (rlang::is_installed("rpart") && rlang::is_installed("rmarkdown")) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} +\dontshow{if (rlang::is_installed("rpart") && rlang::is_installed("rmarkdown")) withAutoprint(\{ # examplesIf} library("mlr3") report_file = tempfile() task = tsk("compas") diff --git a/man/report_modelcard.Rd b/man/report_modelcard.Rd index 3cc97d34..e62dc72f 100644 --- a/man/report_modelcard.Rd +++ b/man/report_modelcard.Rd @@ -25,7 +25,7 @@ Uses the awesome markdown template created by Chris Garbin \href{https://github.com/fau-masters-collected-works-cgarbin/model-card-template}{from Github}. } \examples{ -\dontshow{if (rlang::is_installed("rmarkdown")) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} +\dontshow{if (rlang::is_installed("rmarkdown")) withAutoprint(\{ # examplesIf} report_file = tempfile() report_modelcard(report_file) \dontshow{\}) # examplesIf}