Skip to content

Commit dab8207

Browse files
committed
depend on packages for examples
1 parent 4713b50 commit dab8207

22 files changed

+37
-13
lines changed

R/MeasureFairnessConstraint.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
#' @template pta
88
#' @seealso mlr_measures_fairness
99
#' @export
10-
#' @examples
10+
#' @examplesIf rlang::is_installed("rpart")
1111
#' # Accuracy subject to equalized odds fairness constraint:
1212
#' library("mlr3")
1313
#' t = tsk("adult_train")

R/MeasurePositiveProbability.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
#' This is defined as count of positive predictions divided by the number of observations.
77
#'
88
#' @export
9-
#' @examples
9+
#' @examplesIf rlang::is_installed("rpart")
1010
#' library("mlr3")
1111
#' # Create Positive Probability Measure
1212
#' t = tsk("adult_train")

R/MeasureSubgroup.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
#'
66
#' @seealso [MeasureFairness], [groupwise_metrics]
77
#' @export
8-
#' @examples
8+
#' @examplesIf rlang::is_installed("rpart")
99
#' library("mlr3")
1010
#' # Create MeasureFairness to measure the Predictive Parity.
1111
#' t = tsk("adult_train")

R/PipeOpEOd.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@
8383
#' @family PipeOps
8484
#' @seealso https://mlr3book.mlr-org.com/list-pipeops.html
8585
#' @export
86-
#' @examples
86+
#' @examplesIf rlang::is_installed("rpart")
8787
#' library("mlr3")
8888
#' library("mlr3pipelines")
8989
#'

R/PipeOpReweighing.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@
5959
#' @family PipeOps
6060
#' @seealso https://mlr3book.mlr-org.com/list-pipeops.html
6161
#' @export
62-
#' @examples
62+
#' @examplesIf rlang::is_installed("rpart")
6363
#' library("mlr3")
6464
#' library("mlr3pipelines")
6565
#'

R/compare_metrics.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
#'
3030
#' @export
3131
#' @return A 'ggplot2' object.
32-
#' @examples
32+
#' @examplesIf rlang::is_installed("rpart") && rlang::is_installed("ranger")
3333
#' library("mlr3")
3434
#' library("mlr3learners")
3535
#'

R/compute_metrics.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
#' @param prediction (`vector`) \cr A vector containing predictions.
1414
#' @param metrics (`Metric`|`list`) \cr (List of) mlr3 metrics to apply.
1515
#' @export
16-
#' @examples
16+
#' @examplesIf rlang::is_installed("rpart")
1717
#' library("mlr3")
1818
#' # Get adult data as a data.table
1919
#' train = tsk("adult_train")$data()

R/fairness_accuracy_tradeoff.R

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,12 @@
3030
#' The accuracy measure that will evaluated.
3131
#' Default measure set to be [msr("classif.acc")][mlr3::MeasureClassif].
3232
#' * `task` ([mlr3::TaskClassif])\cr
33-
#' The data task that contains the protected column, only required when the class of object is ([mlr3::PredictionClassif])
33+
#' The data task that contains the protected column, only required
34+
#' when the class of object is ([mlr3::PredictionClassif])
3435
#'
3536
#' @export
3637
#' @return A 'ggplot2' object.
37-
#' @examples
38+
#' @examplesIf rlang::is_installed("rpart") && rlang::is_installed("ranger")
3839
#' library("mlr3")
3940
#' library("mlr3learners")
4041
#' library("ggplot2")

R/fairness_prediction_density.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
#'
2222
#' @export
2323
#' @return A 'ggplot2' object.
24-
#' @examples
24+
#' @examplesIf rlang::is_installed("rpart")
2525
#' library("mlr3")
2626
#' library("mlr3learners")
2727
#'

R/fairness_tensor.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
#' @return
1919
#' `list()` of confusion matrix for every group in `"pta"`.
2020
#' @export
21-
#' @examples
21+
#' @examplesIf rlang::is_installed("rpart")
2222
#' library("mlr3")
2323
#' task = tsk("compas")
2424
#' prediction = lrn("classif.rpart")$train(task)$predict(task)

0 commit comments

Comments
 (0)