Skip to content

Commit

Permalink
[R] Rename aif_dataset function
Browse files Browse the repository at this point in the history
Signed-off-by: milevavantuyl <[email protected]>
  • Loading branch information
milevavantuyl committed Jun 27, 2022
1 parent dc93bc0 commit 44b09cf
Show file tree
Hide file tree
Showing 18 changed files with 29 additions and 29 deletions.
2 changes: 1 addition & 1 deletion aif360/aif360-r/NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

export(adult_dataset)
export(adversarial_debiasing)
export(aif_dataset)
export(bank_dataset)
export(binary_label_dataset)
export(binary_label_dataset_metric)
export(classification_metric)
export(compas_dataset)
Expand Down
4 changes: 2 additions & 2 deletions aif360/aif360-r/R/classification_metric.R
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@
#' # Input dataset
#' data <- data.frame("feat" = c(0,0,1,1,1,1,0,1,1,0), "label" = c(1,0,0,1,0,0,1,0,1,1))
#' # Create aif compatible input dataset
#' act <- aif360::aif_dataset(data_path = data, favor_label=0, unfavor_label=1,
#' act <- aif360::binary_label_dataset(data_path = data, favor_label=0, unfavor_label=1,
#' unprivileged_protected_attribute=0,
#' privileged_protected_attribute=1,
#' target_column="label", protected_attribute="feat")
#' # Classified dataset
#' pred_data <- data.frame("feat" = c(0,0,1,1,1,1,0,1,1,0), "label" = c(1,0,1,1,1,0,1,0,0,1))
#' # Create aif compatible classified dataset
#' pred <- aif360::aif_dataset(data_path = pred_data, favor_label=0, unfavor_label=1,
#' pred <- aif360::binary_label_dataset(data_path = pred_data, favor_label=0, unfavor_label=1,
#' unprivileged_protected_attribute=0,
#' privileged_protected_attribute=1,
#' target_column="label", protected_attribute="feat")
Expand Down
6 changes: 3 additions & 3 deletions aif360/aif360-r/R/dataset.R
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#' @param target_column Name describing the label.
#' @param protected_attribute A feature for which fairness is desired.
#' @usage
#' aif_dataset(data_path, favor_label, unfavor_label,
#' binary_label_dataset(data_path, favor_label, unfavor_label,
#' unprivileged_protected_attribute,
#' privileged_protected_attribute,
#' target_column, protected_attribute)
Expand All @@ -19,7 +19,7 @@
#' # Input dataset
#' data <- data.frame("feat" = c(0,0,1,1,1,1,0,1,1,0), "label" = c(1,0,0,1,0,0,1,0,1,1))
#' # Create aif compatible input dataset
#' act <- aif360::aif_dataset(data_path = data, favor_label=0, unfavor_label=1,
#' act <- aif360::binary_label_dataset(data_path = data, favor_label=0, unfavor_label=1,
#' unprivileged_protected_attribute=0,
#' privileged_protected_attribute=1,
#' target_column="label", protected_attribute="feat")
Expand All @@ -30,7 +30,7 @@
#' @importFrom reticulate py_suppress_warnings py_dict r_to_py
#' @importFrom utils file_test
#'
aif_dataset <- function(data_path, favor_label,
binary_label_dataset <- function(data_path, favor_label,
unfavor_label, unprivileged_protected_attribute,
privileged_protected_attribute,
target_column, protected_attribute) {
Expand Down
2 changes: 1 addition & 1 deletion aif360/aif360-r/R/dataset_metric.R
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#' load_aif360_lib()
#' data <- data.frame("feat" = c(0,0,1,1,1,1,0,1,1,0), "label" = c(1,0,0,1,0,0,1,0,1,1))
#' # Create aif compatible dataset
#' dd <- aif360::aif_dataset(data_path = data,
#' dd <- aif360::binary_label_dataset(data_path = data,
#' favor_label=0, unfavor_label=1,
#' unprivileged_protected_attribute=0,
#' privileged_protected_attribute=1,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,11 @@
#' ad_df_pred$label <- as.character(ad_pred)
#' colnames(ad_df_pred) <- c(ad$feature_names, 'label')
#'
#' ad_ds <- aif_dataset(ad_df, target_column='label', favor_label = 1,
#' ad_ds <- binary_label_dataset(ad_df, target_column='label', favor_label = 1,
#' unfavor_label = 0, unprivileged_protected_attribute = 0,
#' privileged_protected_attribute = 1, protected_attribute='race')
#'
#' ad_ds_pred <- aif_dataset(ad_df_pred, target_column='label', favor_label = 1,
#' ad_ds_pred <- binary_label_dataset(ad_df_pred, target_column='label', favor_label = 1,
#' unfavor_label = 0, unprivileged_protected_attribute = 0,
#' privileged_protected_attribute = 1, protected_attribute='race')
#'
Expand Down
2 changes: 1 addition & 1 deletion aif360/aif360-r/README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ data <- data.frame("feature1" = c(0,0,1,1,1,1,0,1,1,0),
"label" = c(1,0,0,1,0,0,1,0,1,1))

# format the dataset
formatted_dataset <- aif360::aif_dataset(data_path = data,
formatted_dataset <- aif360::binary_label_dataset(data_path = data,
favor_label = 0,
unfavor_label = 1,
unprivileged_protected_attribute = 0,
Expand Down
2 changes: 1 addition & 1 deletion aif360/aif360-r/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ data <- data.frame("feature1" = c(0,0,1,1,1,1,0,1,1,0),
"label" = c(1,0,0,1,0,0,1,0,1,1))

# format the dataset
formatted_dataset <- aif360::aif_dataset(data_path = data,
formatted_dataset <- aif360::binary_label_dataset(data_path = data,
favor_label = 0,
unfavor_label = 1,
unprivileged_protected_attribute = 0,
Expand Down
2 changes: 1 addition & 1 deletion aif360/aif360-r/inst/examples/test.R
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ load_aif360_lib()



dd <- aif360::aif_dataset(
dd <- aif360::binary_label_dataset(
data_path = system.file("extdata", "data.csv", package="aif360"),
favor_label=0,
unfavor_label=1,
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions aif360/aif360-r/man/classification_metric.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions aif360/aif360-r/man/reject_option_classification.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions aif360/aif360-r/tests/testthat/test-adversarial.R
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ context("Comprehensive Test for Inprocessing Adversarial DebiasingAlgorithm")


test_that("running dataset test", {
dd <- aif360::aif_dataset(
dd <- aif360::binary_label_dataset(
data_path = system.file("extdata", "data.csv", package="aif360"),
favor_label=0,
unfavor_label=1,
Expand All @@ -11,7 +11,7 @@ test_that("running dataset test", {
target_column="income",
protected_attribute="sex")

pred <- aif360::aif_dataset(
pred <- aif360::binary_label_dataset(
data_path = system.file("extdata", "actual_data.csv", package="aif360"),
favor_label=1,
unfavor_label=0,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ context("Comprehensive Test for Binary Label Dataset Metric")

test_that("running dataset test", {

dd <- aif360::aif_dataset(
dd <- aif360::binary_label_dataset(
data_path = system.file("extdata", "data.csv", package="aif360"),
favor_label=0,
unfavor_label=1,
Expand Down
4 changes: 2 additions & 2 deletions aif360/aif360-r/tests/testthat/test-classification.R
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ context("Comprehensive Test for Classification Metric")

test_that("running dataset test", {

act <- aif360::aif_dataset(
act <- aif360::binary_label_dataset(
data_path = system.file("extdata", "actual_data.csv", package="aif360"),
favor_label=1,
unfavor_label=0,
Expand All @@ -12,7 +12,7 @@ test_that("running dataset test", {
target_column="income",
protected_attribute="sex")

pred <- aif360::aif_dataset(
pred <- aif360::binary_label_dataset(
data_path = system.file("extdata", "predicted_data.csv", package="aif360"),
favor_label=1,
unfavor_label=0,
Expand Down
2 changes: 1 addition & 1 deletion aif360/aif360-r/tests/testthat/test-dataset.R
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ context("Comprehensive Test for Binary Dataset Creation")

test_that("running dataset test", {

dd <- aif360::aif_dataset(
dd <- aif360::binary_label_dataset(
data_path = system.file("extdata", "data.csv", package="aif360"),
favor_label=0,
unfavor_label=1,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ context("Comprehensive Test for Disparate Impact Remover Algorithm")


test_that("running dataset test", {
dd <- aif360::aif_dataset(
dd <- aif360::binary_label_dataset(
data_path = system.file("extdata", "data.csv", package="aif360"),
favor_label=0,
unfavor_label=1,
Expand Down
2 changes: 1 addition & 1 deletion aif360/aif360-r/tests/testthat/test-prejudice-remover.R
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ context("Comprehensive Test for Prejudice Remover Algorithm")


test_that("running prejudice remover test", {
dd <- aif360::aif_dataset(
dd <- aif360::binary_label_dataset(
data_path = system.file("extdata", "data.csv", package="aif360"),
favor_label=0,
unfavor_label=1,
Expand Down
2 changes: 1 addition & 1 deletion aif360/aif360-r/tests/testthat/test-reweighing.R
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ context("Comprehensive Test for Preprocessing Reweighing Algorithm")


test_that("running dataset test", {
dd <- aif360::aif_dataset(
dd <- aif360::binary_label_dataset(
data_path = system.file("extdata", "data.csv", package="aif360"),
favor_label=0,
unfavor_label=1,
Expand Down

0 comments on commit 44b09cf

Please sign in to comment.