Skip to content

Commit

Permalink
Merge pull request #9 from tgsmith61591/release-0.4
Browse files Browse the repository at this point in the history
Release 0.4
  • Loading branch information
tgsmith61591 authored Jun 22, 2017
2 parents 9db02f4 + d6603db commit 8e75e2c
Show file tree
Hide file tree
Showing 31 changed files with 2,071 additions and 524 deletions.
1 change: 1 addition & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
[run]
source = smrt
include = */smrt/*
omit =
*/python?.?/*
*/lib-python/?.?/*.py
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ var/
.installed.cfg
*.egg

# Serialized python
*.pkl

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
Expand Down
28 changes: 23 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
[![Build status](https://travis-ci.org/tgsmith61591/smrt.svg?branch=master)](https://travis-ci.org/tgsmith61591/smrt)
![Supported versions](https://img.shields.io/badge/python-2.7-blue.svg)
[![codecov](https://codecov.io/gh/tgsmith61591/smrt/branch/master/graph/badge.svg)](https://codecov.io/gh/tgsmith61591/smrt)
![Supported versions](https://img.shields.io/badge/python-2.7-blue.svg)
![Supported versions](https://img.shields.io/badge/python-3.5-blue.svg)


# Synthetic Minority Reconstruction Technique (SMRT)
# Synthetic Minority Reconstruction Technique ([SMRT](https://www.youtube.com/watch?v=tcGQpjCztgA))
*Handle your class imbalance more intelligently by using SMOTE's younger, more sophisticated cousin*


### Installation
## Installation

Installation is easy. After cloning the project onto your machine and installing the required dependencies,
simply use the `setup.py` file:
Expand All @@ -18,7 +19,7 @@ $ cd smrt
$ python setup.py install
```

### About
## About

SMRT (Sythetic Minority Reconstruction Technique) is the new SMOTE (Synthetic Minority Oversampling TEchnique).
Using variational auto-encoders, SMRT learns the latent factors that best reconstruct the observations in each
Expand All @@ -32,8 +33,25 @@ too close to the decision boundary for reliable classification, and could lead t
of an estimator. SMRT avoids this risk implicitly, as the [``VariationalAutoencoder``](smrt/autoencode/autoencoder.py)
learns a distribution that is generalizable to the lowest-error (i.e., most archetypal) observations.

__See [the paper](doc/smrt.tex) for more in-depth reference.__

## Example

The [SMRT example](examples/) is an ipython notebook with reproducible code and data that compares an imbalanced
variant of the MNIST dataset after being balanced with both SMOTE and SMRT. The following are several of the resulting
images produced from both SMOTE and SMRT, respectively. Even visually, it's evident that SMRT better synthesizes data
that resembles the input data.

### Original:

The MNIST dataset was amended to contain only zeros and ones in an unbalanced (~1:100, respectively) ratio. The top row
are the original MNIST images, the second row is the SMRT-generated images, and the bottom row is the SMOTE-generated
images:
<br/>
<img src="examples/img/mnist_smrt_smote.png" width="600" alt="Original"/>

### Notes

- See [examples](examples/) for usage
- See [the paper](doc/smrt.tex) for more in-depth documentation
- Information on [the authors](AUTHORS.md)
- S-M-R-T [original reference](https://www.youtube.com/watch?v=tcGQpjCztgA) (enable audio)
4 changes: 3 additions & 1 deletion build_tools/travis/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,15 @@ if [[ "$DISTRIB" == "conda" ]]; then

pip install scikit-learn==$SCIKIT_LEARN_VERSION
pip install coveralls
pip install codecov

# Install TensorFlow
# we have to make sure we install the CPU version otherwise we get into GCC/G++ issues...
if [[ "$PYTHON_VERSION" == "2.7" ]]; then
pip install https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-1.0.0-cp27-none-linux_x86_64.whl;
elif [[ "$PYTHON_VERSION" == "3.5" ]]; then
pip install http://ci.tensorflow.org/view/Nightly/job/nightly-python35-linux-cpu/lastSuccessfulBuild/artifact/pip_test/whl/tensorflow-1.0.0rc2-cp35-cp35m-linux_x86_64.whl;
# pip install http://ci.tensorflow.org/view/Nightly/job/nightly-python35-linux-cpu/lastSuccessfulBuild/artifact/pip_test/whl/tensorflow-1.0.0rc2-cp35-cp35m-linux_x86_64.whl;
pip install https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-1.0.0-cp35-cp35m-linux_x86_64.whl;
fi

# Install nose-timer via pip
Expand Down
3 changes: 2 additions & 1 deletion build_tools/travis/test_script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ python -c "import scipy; print('scipy %s' % scipy.__version__)"
python -c "import multiprocessing as mp; print('%d CPUs' % mp.cpu_count())"

run_tests() {
# Get into a temp directory to run test from the installed scikit learn and
# Get into a temp directory to run test from the installed smrt and
# check if we do not leave artifacts
mkdir -p $TEST_DIR
# We need the setup.cfg for the nose settings
Expand All @@ -23,6 +23,7 @@ run_tests() {

if [[ "$COVERAGE" == "true" ]]; then
nosetests -s --with-coverage --with-timer --timer-top-n 20 smrt
codecov --token=6de72173-c50f-4ebb-b7f1-22d592f56b01
else
nosetests -s --with-timer --timer-top-n 20 smrt
fi
Expand Down
Loading

0 comments on commit 8e75e2c

Please sign in to comment.