-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Yash Savani
committed
Jun 15, 2020
1 parent
e172f2a
commit 34d6646
Showing
42 changed files
with
4,283 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# .coveragerc to control coverage.py | ||
[run] | ||
branch = True | ||
source = deco | ||
# omit = bad_file.py | ||
|
||
[paths] | ||
source = | ||
src/ | ||
*/site-packages/ | ||
|
||
[report] | ||
# Regexes for lines to exclude from consideration | ||
exclude_lines = | ||
# Have to re-enable the standard pragma | ||
pragma: no cover | ||
|
||
# Don't complain about missing debug-only code: | ||
def __repr__ | ||
if self\.debug | ||
|
||
# Don't complain if tests don't hit defensive assertion code: | ||
raise AssertionError | ||
raise NotImplementedError | ||
|
||
# Don't complain if non-runnable code isn't run: | ||
if 0: | ||
if __name__ == .__main__.: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
# Temporary and binary files | ||
*~ | ||
*.py[cod] | ||
*.so | ||
*.cfg | ||
!.isort.cfg | ||
!setup.cfg | ||
*.orig | ||
*.log | ||
*.pot | ||
__pycache__/* | ||
.cache/* | ||
.*.swp | ||
*/.ipynb_checkpoints/* | ||
.DS_Store | ||
|
||
# Project files | ||
.ropeproject | ||
.project | ||
.pydevproject | ||
.settings | ||
.idea | ||
tags | ||
|
||
# Package files | ||
*.egg | ||
*.eggs/ | ||
.installed.cfg | ||
*.egg-info | ||
|
||
# Unittest and coverage | ||
htmlcov/* | ||
.coverage | ||
.tox | ||
junit.xml | ||
coverage.xml | ||
.pytest_cache/ | ||
|
||
# Build and docs folder/files | ||
build/* | ||
dist/* | ||
sdist/* | ||
docs/api/* | ||
docs/_rst/* | ||
docs/_build/* | ||
cover/* | ||
MANIFEST | ||
|
||
# Per-project virtualenvs | ||
.venv*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
[settings] | ||
line_length=88 | ||
indent=' ' | ||
skip=.tox,.venv,build,dist | ||
known_standard_library=setuptools,pkg_resources | ||
known_test=pytest | ||
known_first_party=deco | ||
sections=FUTURE,STDLIB,COMPAT,TEST,THIRDPARTY,FIRSTPARTY,LOCALFOLDER | ||
default_section=THIRDPARTY | ||
multi_line_output=3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
exclude: '^docs/conf.py' | ||
|
||
repos: | ||
- repo: git://github.com/pre-commit/pre-commit-hooks | ||
rev: v2.2.3 | ||
hooks: | ||
- id: trailing-whitespace | ||
- id: check-added-large-files | ||
- id: check-ast | ||
- id: check-json | ||
- id: check-merge-conflict | ||
- id: check-xml | ||
- id: check-yaml | ||
- id: debug-statements | ||
- id: end-of-file-fixer | ||
- id: requirements-txt-fixer | ||
- id: mixed-line-ending | ||
args: ['--fix=no'] | ||
- id: flake8 | ||
args: ['--max-line-length=88'] # default of Black | ||
|
||
- repo: https://github.com/pre-commit/mirrors-isort | ||
rev: v4.3.4 | ||
hooks: | ||
- id: isort |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
========= | ||
Changelog | ||
========= | ||
|
||
Version 0.1 | ||
=========== | ||
|
||
- Feature A added | ||
- FIX: nasty bug #1729 fixed | ||
- add your changes here! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
The MIT License (MIT) | ||
|
||
Copyright (c) 2020 Author | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,112 @@ | ||
# deco | ||
|
||
Deco is a new approach for reducing bias. | ||
|
||
## Description . | ||
|
||
In our approach, we treat debiasing as an optimization problem and | ||
apply optimization procedures to parts of an already trained machine | ||
learning model. For instance, given a trained neural network, we | ||
apply optimization to set the weights on one or more layers of the | ||
network such that the weights reduce some combination of bias measures | ||
without sacrificing performance. | ||
|
||
<img src='https://miro.medium.com/max/1400/1*0hTrFIGMWxKRcTWOnjL9Dw.gif'> | ||
|
||
## Installation | ||
|
||
In order to set up the necessary environment: | ||
|
||
1. create an environment `deco` with the help of [conda], | ||
``` | ||
conda env create -f environment.yaml | ||
``` | ||
2. activate the new environment with | ||
``` | ||
conda activate deco | ||
``` | ||
3. install `deco` with: | ||
``` | ||
python setup.py install # or `develop` | ||
``` | ||
|
||
Optional and needed only once after `git clone`: | ||
|
||
4. install several [pre-commit] git hooks with: | ||
``` | ||
pre-commit install | ||
``` | ||
and checkout the configuration under `.pre-commit-config.yaml`. | ||
The `-n, --no-verify` flag of `git commit` can be used to deactivate pre-commit hooks temporarily. | ||
|
||
5. install [nbstripout] git hooks to remove the output cells of committed notebooks with: | ||
``` | ||
nbstripout --install --attributes notebooks/.gitattributes | ||
``` | ||
This is useful to avoid large diffs due to plots in your notebooks. | ||
A simple `nbstripout --uninstall` will revert these changes. | ||
|
||
|
||
Then take a look into the `scripts` and `notebooks` folders. | ||
|
||
## Dependency Management & Reproducibility | ||
|
||
1. Always keep your abstract (unpinned) dependencies updated in `environment.yaml` and eventually | ||
in `setup.cfg` if you want to ship and install your package via `pip` later on. | ||
2. Create concrete dependencies as `environment.lock.yaml` for the exact reproduction of your | ||
environment with: | ||
``` | ||
conda env export -n deco -f environment.lock.yaml | ||
``` | ||
For multi-OS development, consider using `--no-builds` during the export. | ||
3. Update your current environment with respect to a new `environment.lock.yaml` using: | ||
``` | ||
conda env update -f environment.lock.yaml --prune | ||
``` | ||
## Project Organization | ||
|
||
``` | ||
├── AUTHORS.rst <- List of developers and maintainers. | ||
├── CHANGELOG.rst <- Changelog to keep track of new features and fixes. | ||
├── LICENSE.txt <- License as chosen on the command-line. | ||
├── README.md <- The top-level README for developers. | ||
├── configs <- Directory for configurations of model & application. | ||
├── data | ||
│ ├── external <- Data from third party sources. | ||
│ ├── interim <- Intermediate data that has been transformed. | ||
│ ├── processed <- The final, canonical data sets for modeling. | ||
│ └── raw <- The original, immutable data dump. | ||
├── docs <- Directory for Sphinx documentation in rst or md. | ||
├── environment.yaml <- The conda environment file for reproducibility. | ||
├── models <- Trained and serialized models, model predictions, | ||
│ or model summaries. | ||
├── notebooks <- Jupyter notebooks. Naming convention is a number (for | ||
│ ordering), the creator's initials and a description, | ||
│ e.g. `1.0-fw-initial-data-exploration`. | ||
├── references <- Data dictionaries, manuals, and all other materials. | ||
├── reports <- Generated analysis as HTML, PDF, LaTeX, etc. | ||
│ └── figures <- Generated plots and figures for reports. | ||
├── scripts <- Analysis and production scripts which import the | ||
│ actual PYTHON_PKG, e.g. train_model. | ||
├── setup.cfg <- Declarative configuration of your project. | ||
├── setup.py <- Use `python setup.py develop` to install for development or | ||
| or create a distribution with `python setup.py bdist_wheel`. | ||
├── src | ||
│ └── deco <- Actual Python package where the main functionality goes. | ||
├── tests <- Unit tests which can be run with `py.test`. | ||
├── .coveragerc <- Configuration for coverage reports of unit tests. | ||
├── .isort.cfg <- Configuration for git hook that sorts imports. | ||
└── .pre-commit-config.yaml <- Configuration of pre-commit git hooks. | ||
``` | ||
|
||
## Note | ||
|
||
This project has been set up using PyScaffold 3.2.3 and the [dsproject extension] 0.4. | ||
For details and usage information on PyScaffold see https://pyscaffold.org/. | ||
|
||
[conda]: https://docs.conda.io/ | ||
[pre-commit]: https://pre-commit.com/ | ||
[Jupyter]: https://jupyter.org/ | ||
[nbstripout]: https://github.com/kynan/nbstripout | ||
[Google style]: http://google.github.io/styleguide/pyguide.html#38-comments-and-docstrings | ||
[dsproject extension]: https://github.com/pyscaffold/pyscaffoldext-dsproject |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# Ignore everything in this directory | ||
* | ||
# Except this file and .gitignore in sub directories | ||
!.gitignore | ||
!raw | ||
!external | ||
!preprocessed | ||
!interim |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# Ignore everything in this directory | ||
* | ||
# Except this file | ||
!.gitignore |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# Ignore everything in this directory | ||
* | ||
# Except this file | ||
!.gitignore |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# Ignore everything in this directory | ||
* | ||
# Except this file | ||
!.gitignore |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# Ignore everything in this directory | ||
* | ||
# Except this file | ||
!.gitignore |
Oops, something went wrong.