File size: 1,030 Bytes
d2a8669
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#' Disparate Impact Remover
#' @description Disparate impact remover is a preprocessing technique that edits feature values increase group fairness while preserving rank-ordering within groups
#' @param repair_level Repair amount. 0.0 is no repair while 1.0 is full repair.
#' @param sensitive_attribute Single protected attribute with which to do repair.
#' @usage disparate_impact_remover(repair_level = 1.0, sensitive_attribute = '')
#' @examples
#' \dontrun{
#' # An example using the Adult Dataset
#' load_aif360_lib()
#' ad <- adult_dataset()
#' p <- list("race", 1)
#' u <- list("race", 0)
#'
#' di <- disparate_impact_remover(repair_level = 1.0, sensitive_attribute = "race")
#' rp <- di$fit_transform(ad)
#'
#' di_2 <- disparate_impact_remover(repair_level = 0.8, sensitive_attribute = "race")
#' rp_2 <- di_2$fit_transform(ad)
#' }
#' @export
#'
disparate_impact_remover <- function(repair_level=1.0, sensitive_attribute='') {
  dr <- pre_algo$DisparateImpactRemover(repair_level, sensitive_attribute)
  return (dr)
}