-
Notifications
You must be signed in to change notification settings - Fork 0
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
Nana Mensah
authored and
Nana Mensah
committed
Sep 6, 2019
1 parent
2ec4380
commit beeb972
Showing
5 changed files
with
174 additions
and
1 deletion.
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 |
---|---|---|
@@ -1,5 +1,6 @@ | ||
# ploffer ignores | ||
.snakemake/ | ||
.vscode/ | ||
|
||
# Byte-compiled / optimized / DLL files | ||
__pycache__/ | ||
|
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 @@ | ||
MIT License | ||
|
||
Copyright (c) 2019 Nana Mensah | ||
|
||
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 |
---|---|---|
@@ -1,2 +1,59 @@ | ||
# snakepot | ||
:tea: A snakemake wrapper for the TPOT auto-ML classifier | ||
|
||
![snakepot_logo](_assets/snakepot.png) | ||
|
||
`snakepot` is a snakemake workflow designed to train and evaluate a binary classifier using the [TPOT auto-ML library](http://automl.info/tpot/). | ||
|
||
## Quick Start | ||
|
||
1. [Install snakepot](#Setup) (requires conda) | ||
|
||
1. Edit parameters in [config.json](#config.json) | ||
|
||
1. Run `snakemake` | ||
|
||
1. View outputs in new directory | ||
|
||
## Features | ||
|
||
I developed `snakepot` during my elective at the William Harvey Research Institute. We used `snakepot` to quickly train a baseline model on a variety of gene-phenotype datasets. The workflow takes the following steps: | ||
|
||
1. Clean the data set (simple N/A drop by rows and explicit drop by columns) | ||
2. Split data into train/test/validate sets | ||
3. Call the TPOT automated machine learning algorithm to train a classifier | ||
4. Save classifier and re-run it on the houldout/validation data | ||
5. Evaluate the classifier on the holdout set | ||
6. Call the classifier for predictions on the unlabelled data | ||
|
||
An example dataset (/test/data.csv) and config file (config.json) are provided. | ||
|
||
## Installation | ||
|
||
```bash | ||
# Build conda environment | ||
conda env create -f environment.yaml | ||
conda activate snakepot | ||
# Install python helper scripts to path | ||
pip install . | ||
# Run the workflow in Snakefile using config.json | ||
snakemake | ||
``` | ||
|
||
## config.json | ||
|
||
|Parameter|Description| | ||
|-----|-----| | ||
|directory|Output directory for new files| | ||
|input|Input CSV file. All data must be encoded as binary or continuous variables| | ||
|drop_columns|Features to drop from the data. Skipped if not found| | ||
|encode_columns|Categorical features to encode. Skipped if not found| | ||
|target_column|The name of the target variable| | ||
|target_1|Target variable value to label as '1'| | ||
|target_0|Target variable value to label as '0'| | ||
|to_predict|Target variable value for final predictions| | ||
|perc_split|Percentage of training data (target '1' or '0') to split for holdout set| | ||
|TPOT_max_time|Maximum time to run TPOT in muntes| | ||
|
||
## License | ||
|
||
MIT License. Copyright (c) 2019 Nana Mensah |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,94 @@ | ||
name: snakepot | ||
channels: | ||
- bioconda | ||
- conda-forge | ||
- defaults | ||
dependencies: | ||
- snakemake-minimal=5.4.4=py_1 | ||
- appdirs=1.4.3=py_1 | ||
- asn1crypto=0.24.0=py37_1003 | ||
- attrs=19.1.0=py_0 | ||
- blas=1.0=mkl | ||
- category_encoders=1.3.0=py_0 | ||
- certifi=2019.3.9=py37_0 | ||
- cffi=1.12.2=py37hf0e25f4_1 | ||
- chardet=3.0.4=py37_1003 | ||
- configargparse=0.13.0=py_1 | ||
- cryptography=2.6.1=py37h72c5cf5_0 | ||
- datrie=0.7.1=py37h14c3975_0 | ||
- docutils=0.14=py37_1001 | ||
- gitdb2=2.0.5=py_0 | ||
- gitpython=2.1.11=py_0 | ||
- idna=2.8=py37_1000 | ||
- jedi=0.13.3=py37_0 | ||
- jsonschema=3.0.1=py37_0 | ||
- patsy=0.5.1=py_0 | ||
- pexpect=4.6.0=py37_0 | ||
- pip=19.0.3=py37_0 | ||
- psutil=5.6.1=py37h14c3975_0 | ||
- ptyprocess=0.6.0=py37_0 | ||
- pycparser=2.19=py37_1 | ||
- pyopenssl=19.0.0=py37_0 | ||
- pyrsistent=0.14.11=py37h14c3975_0 | ||
- pysocks=1.6.8=py37_1002 | ||
- pyyaml=5.1=py37h14c3975_0 | ||
- ratelimiter=1.2.0=py37_1000 | ||
- requests=2.21.0=py37_1000 | ||
- setuptools=41.0.0=py37_0 | ||
- smmap2=2.0.5=py_0 | ||
- statsmodels=0.9.0=py37h3010b51_1000 | ||
- traitlets=4.3.2=py37_0 | ||
- urllib3=1.24.1=py37_1000 | ||
- wheel=0.33.1=py37_0 | ||
- wrapt=1.11.1=py37h14c3975_0 | ||
- yaml=0.1.7=h14c3975_1001 | ||
- _libgcc_mutex=0.1=main | ||
- backcall=0.1.0=py37_0 | ||
- ca-certificates=2019.1.23=0 | ||
- decorator=4.4.0=py37_1 | ||
- intel-openmp=2019.3=199 | ||
- ipython=7.4.0=py37h39e3cac_0 | ||
- ipython_genutils=0.2.0=py37_0 | ||
- joblib=0.13.2=py37_0 | ||
- libedit=3.1.20181209=hc058e9b_0 | ||
- libffi=3.2.1=hd88cf55_4 | ||
- libgcc-ng=8.2.0=hdf63c60_1 | ||
- libgfortran-ng=7.3.0=hdf63c60_0 | ||
- libstdcxx-ng=8.2.0=hdf63c60_1 | ||
- mkl=2019.3=199 | ||
- mkl_fft=1.0.10=py37ha843d7b_0 | ||
- mkl_random=1.0.2=py37hd81dba3_0 | ||
- ncurses=6.1=he6710b0_1 | ||
- numpy=1.16.2=py37h7e9f1db_0 | ||
- numpy-base=1.16.2=py37hde5b4d6_0 | ||
- openssl=1.1.1b=h7b6447c_1 | ||
- pandas=0.24.2=py37he6710b0_0 | ||
- parso=0.3.4=py37_0 | ||
- pickleshare=0.7.5=py37_0 | ||
- prompt_toolkit=2.0.9=py37_0 | ||
- pygments=2.3.1=py37_0 | ||
- python=3.7.3=h0371630_0 | ||
- python-dateutil=2.8.0=py37_0 | ||
- pytz=2018.9=py37_0 | ||
- readline=7.0=h7b6447c_5 | ||
- scikit-learn=0.20.3=py37hd81dba3_0 | ||
- scipy=1.2.1=py37h7c811a0_0 | ||
- six=1.12.0=py37_0 | ||
- sqlite=3.27.2=h7b6447c_0 | ||
- tk=8.6.8=hbc83047_0 | ||
- wcwidth=0.1.7=py37_0 | ||
- xz=5.2.4=h14c3975_4 | ||
- zlib=1.2.11=h7b6447c_3 | ||
- pip: | ||
- beautifulsoup4==4.8.0 | ||
- deap==1.2.2 | ||
- logbook==1.5.2 | ||
- snakemake==5.4.4 | ||
- snowballstemmer==1.2.1 | ||
- soupsieve==1.9.3 | ||
- stopit==1.1.2 | ||
- tpot==0.10.0 | ||
- tqdm==4.31.1 | ||
- update-checker==0.16 | ||
prefix: /home/nana/miniconda3/envs/snakepot | ||
|