fairadapt
Fair data adaptation using causal graphical models with R.
Science Score: 20.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
○CITATION.cff file
-
○codemeta.json file
-
○.zenodo.json file
-
○DOI references
-
✓Academic publication links
Links to: arxiv.org -
✓Committers with academic emails
2 of 7 committers (28.6%) from academic institutions -
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (18.0%) to scientific vocabulary
Keywords
causal-inference
fairness
machine-learning
r
Last synced: 6 months ago
·
JSON representation
Repository
Fair data adaptation using causal graphical models with R.
Basic Info
- Host: GitHub
- Owner: dplecko
- License: gpl-3.0
- Language: R
- Default Branch: main
- Homepage: http://dplecko.github.io/fairadapt/
- Size: 51.5 MB
Statistics
- Stars: 2
- Watchers: 1
- Forks: 2
- Open Issues: 0
- Releases: 0
Topics
causal-inference
fairness
machine-learning
r
Created over 6 years ago
· Last pushed over 2 years ago
Metadata Files
Readme
License
README.Rmd
---
output:
github_document:
html_preview: false
---
```{r setup, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
```
# [fairadapt](https://dplecko.github.io/fairadapt/)
[](https://lifecycle.r-lib.org/articles/stages.html#stable)
[](https://github.com/dplecko/fairadapt/actions?query=workflow%3Abuild)
[](https://github.com/dplecko/fairadapt/actions?query=workflow%3Acheck)
[](https://github.com/dplecko/fairadapt/actions?query=workflow%3Apkgdown)
[](https://github.com/dplecko/fairadapt/actions?query=workflow%3Acoverage)
[](https://app.codecov.io/gh/dplecko/fairadapt)
The R package fairadapt is intended for removing bias from machine learning algorithms. In particular, it implements the pre-processing procedure described in [Plecko & Meinshausen, 2019](https://arxiv.org/abs/1911.06685) (all the code used for producing the figures in the paper can be found in the `jmlr-paper` folder). The main idea is to adapt the training and testing data in a way which prevents any further training procedure from learning an undesired bias. The package currently offers the pre-processing step, after which the user can use the adapted data to train any classifier. However, some caution on the training step is still advised, so for more involved applications with resolving variables, the user should refer to the original paper.
## Installation
You can install the released version of fairadapt from [CRAN](https://CRAN.R-project.org) with:
```{r, eval = FALSE}
install.packages("fairadapt")
```
## Example
An example of how fairadapt can be used is demonstrated below on the UCI Adult dataset.
```{r, example}
# loading the package
library(fairadapt)
vars <- c("sex", "age", "native_country", "marital_status", "education_num",
"workclass", "hours_per_week", "occupation", "income")
# initialising the adjacency matrix
adj.mat <- c(
0, 0, 0, 1, 1, 1, 1, 1, 1, # sex
0, 0, 0, 1, 1, 1, 1, 1, 1, # age
0, 0, 0, 1, 1, 1, 1, 1, 1, # native_country
0, 0, 0, 0, 1, 1, 1, 1, 1, # marital_status
0, 0, 0, 0, 0, 1, 1, 1, 1, # education_num
0, 0, 0, 0, 0, 0, 0, 0, 1, # workclass
0, 0, 0, 0, 0, 0, 0, 0, 1, # hours_per_week
0, 0, 0, 0, 0, 0, 0, 0, 1, # occupation
0, 0, 0, 0, 0, 0, 0, 0, 0 # income
)
adj.mat <- matrix(adj.mat, nrow = length(vars), ncol = length(vars),
dimnames = list(vars, vars), byrow = TRUE)
# reading in the UCI Adult data
adult <- readRDS(
system.file("extdata", "uci_adult.rds", package = "fairadapt")
)
n <- nrow(adult) / 2
mod <- fairadapt(income ~ .,
train.data = head(adult[, vars], n = n),
test.data = tail(adult[, vars], n = n),
prot.attr = "sex", adj.mat = adj.mat,
res.vars = "hours_per_week")
adapt.train <- adaptedData(mod)
adapt.test <- adaptedData(mod, train = FALSE)
summary(mod)
```
Owner
- Login: dplecko
- Kind: user
- Repositories: 1
- Profile: https://github.com/dplecko
GitHub Events
Total
Last Year
Committers
Last synced: over 2 years ago
Top Committers
| Name | Commits | |
|---|---|---|
| Drago Plecko | w****o@g****m | 54 |
| Nicolas Bennett | n****t@s****h | 50 |
| Drago Plecko | d****o@s****h | 40 |
| Nicolas Bennett | n****t@i****m | 34 |
| Drago Plecko | p****d@D****l | 4 |
| Drago Plecko | p****d@D****l | 3 |
| Nicolas Bennett | n****t@z****h | 1 |
Committer Domains (Top 20 + Academic)
Issues and Pull Requests
Last synced: 6 months ago
All Time
- Total issues: 1
- Total pull requests: 6
- Average time to close issues: 3 months
- Average time to close pull requests: 3 days
- Total issue authors: 1
- Total pull request authors: 1
- Average comments per issue: 0.0
- Average comments per pull request: 0.17
- Merged pull requests: 6
- Bot issues: 0
- Bot pull requests: 0
Past Year
- Issues: 0
- Pull requests: 0
- Average time to close issues: N/A
- Average time to close pull requests: N/A
- Issue authors: 0
- Pull request authors: 0
- Average comments per issue: 0
- Average comments per pull request: 0
- Merged pull requests: 0
- Bot issues: 0
- Bot pull requests: 0
Top Authors
Issue Authors
- nbenn (1)
Pull Request Authors
- nbenn (6)
Top Labels
Issue Labels
Pull Request Labels
Packages
- Total packages: 1
-
Total downloads:
- cran 333 last-month
- Total dependent packages: 0
- Total dependent repositories: 0
- Total versions: 10
- Total maintainers: 1
cran.r-project.org: fairadapt
Fair Data Adaptation with Quantile Preservation
- Homepage: https://github.com/dplecko/fairadapt
- Documentation: http://cran.r-project.org/web/packages/fairadapt/fairadapt.pdf
- License: GPL (≥ 3)
-
Latest release: 1.0.0
published over 1 year ago
Rankings
Forks count: 17.8%
Dependent packages count: 29.8%
Average: 31.8%
Stargazers count: 35.2%
Dependent repos count: 35.5%
Downloads: 40.6%
Maintainers (1)
Last synced:
6 months ago
Dependencies
DESCRIPTION
cran
- R >= 3.5.0 depends
- assertthat * imports
- cowplot * imports
- ggplot2 * imports
- igraph * imports
- qrnn * imports
- quantreg * imports
- ranger >= 0.13.1 imports
- scales * imports
- ggraph * suggests
- knitr * suggests
- magick * suggests
- microbenchmark * suggests
- mvtnorm * suggests
- pdftools * suggests
- rmarkdown * suggests
- rticles * suggests
- testthat >= 3.0.3 suggests
- xtable * suggests