Skip to content

Commit

Permalink
add missing package to suggests
Browse files Browse the repository at this point in the history
  • Loading branch information
mllg committed Feb 22, 2024
1 parent 8bf1aa3 commit 23b40b0
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 8 deletions.
1 change: 1 addition & 0 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ Imports:
ggplot2
Suggests:
testthat (>= 3.1.0),
CVXR,
patchwork,
rpart,
ranger,
Expand Down
8 changes: 4 additions & 4 deletions R/learner_fairml_classif_fairzlrm.R
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#' @title Classification Fair Logistic Regression With Covariance Constraints Learner
#' @author pfistfl
#' @details
#' @details
#' Generalized fair regression model from Zafar et al., 2019 implemented via package `fairml`.
#' The 'unfairness' parameter is set to 0.05 as a default.
#' The optimized fairness metric is statistical parity.
#'
#'
#' @name mlr_learners_classif.fairzlrm
#'
#' @template class_learner
Expand All @@ -13,7 +13,7 @@
#'
#' @references
#' `r format_bib("zafar19a")`
#'
#'
#' @template seealso_learner
#' @template example
#' @export
Expand All @@ -31,7 +31,7 @@ LearnerClassifFairzlrm = R6Class("LearnerClassifFairzlrm",
ps$values = list(unfairness = 0.05, intersect = FALSE)
super$initialize(
id = "classif.fairzlrm",
packages = "fairml",
packages = c("fairml", "CVXR"),
feature_types = c("integer", "numeric", "factor", "ordered"),
predict_types = c("response", "prob"),
properties = "twoclass",
Expand Down
6 changes: 3 additions & 3 deletions R/learner_fairml_regr_fairzlm.R
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#' @title Regression Fair Regression With Covariance Constraints Learner
#' @author pfistfl
#' @details
#' @details
#' Fair regression model from Zafar et al., 2019 implemented via package `fairml`.
#' The 'unfairness' parameter is set to 0.05 as a default.
#' The optimized fairness metric is statistical parity.
#'
#'
#' @name mlr_learners_regr.fairzlm
#'
#' @template class_learner
Expand All @@ -31,7 +31,7 @@ LearnerRegrFairzlm = R6Class("LearnerRegrFairzlm",
ps$values = list(unfairness = 0.05, intersect = FALSE)
super$initialize(
id = "regr.fairzlm",
packages = "fairml",
packages = c("fairml", "CVXR"),
feature_types = c("integer", "numeric", "factor", "ordered"),
predict_types = c("response"),
param_set = ps,
Expand Down
4 changes: 3 additions & 1 deletion tests/testthat/test_learners_fairml.R
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,10 @@ test_that("regr.fairfrrm", {
test_that("regr.fairzlm", {
skip_on_cran()
skip_if_not_installed("fairml")
skip_if_not_installed("CVXR")
learner = lrn("regr.fairzlm", unfairness = 0.5)
out = expect_learner(learner)

task = TaskRegr$new("long", fairml::national.longitudinal.survey, target = "income06")
task$col_roles$pta = "gender"
simple_autotest(learner, task)
Expand All @@ -38,6 +39,7 @@ test_that("regr.fairzlm", {
test_that("classif.fairzlrm", {
skip_on_cran()
skip_if_not_installed("fairml")
skip_if_not_installed("CVXR")
learner = lrn("classif.fairzlrm", unfairness = 0.2)
out = expect_learner(learner)

Expand Down

0 comments on commit 23b40b0

Please sign in to comment.