diff options
author | Rémi Flamary <remi.flamary@gmail.com> | 2016-11-08 09:19:30 +0100 |
---|---|---|
committer | Rémi Flamary <remi.flamary@gmail.com> | 2016-11-08 09:19:30 +0100 |
commit | 2ccba4bf4bd0a13f82ffeb34c05e97c80466a030 (patch) | |
tree | e5adf6fb907cd95413759a917b58e5a398af197c | |
parent | db70a830756eb5d6a9c3d76fefc479b5a3daade6 (diff) |
travis CI
-rw-r--r-- | Makefile | 3 | ||||
-rw-r--r-- | ot/__init__.py | 1 | ||||
-rw-r--r-- | ot/bregman.py | 7 | ||||
-rw-r--r-- | ot/lp/__init__.py | 2 | ||||
-rw-r--r-- | requirements.txt | 5 | ||||
-rw-r--r-- | test/test_load_module.py | 10 | ||||
-rw-r--r-- | travis.yml | 16 |
7 files changed, 41 insertions, 3 deletions
@@ -33,6 +33,9 @@ sremove : clean : $(PYTHON) setup.py clean + +test: + pytest uploadpypi: #python setup.py register diff --git a/ot/__init__.py b/ot/__init__.py index 08b57eb..a925a6f 100644 --- a/ot/__init__.py +++ b/ot/__init__.py @@ -1,5 +1,6 @@ """Python Optimal Transport toolbox""" + # All submodules and packages from . import lp from . import bregman diff --git a/ot/bregman.py b/ot/bregman.py index 91c526a..568ead2 100644 --- a/ot/bregman.py +++ b/ot/bregman.py @@ -59,6 +59,7 @@ def sinkhorn(a,b, M, reg, numItermax = 1000, stopThr=1e-9, verbose=False, log=Fa Examples -------- + >>> import ot >>> a=[.5,.5] >>> b=[.5,.5] >>> M=[[0.,1.],[1.,0.]] @@ -203,10 +204,11 @@ def sinkhorn_stabilized(a,b, M, reg, numItermax = 1000,tau=1e3, stopThr=1e-9,war Examples -------- + >>> import ot >>> a=[.5,.5] >>> b=[.5,.5] >>> M=[[0.,1.],[1.,0.]] - >>> ot.sinkhorn(a,b,M,1) + >>> ot.bregman.sinkhorn_stabilized(a,b,M,1) array([[ 0.36552929, 0.13447071], [ 0.13447071, 0.36552929]]) @@ -394,10 +396,11 @@ def sinkhorn_epsilon_scaling(a,b, M, reg, numItermax = 100, epsilon0=1e4, numInn Examples -------- + >>> import ot >>> a=[.5,.5] >>> b=[.5,.5] >>> M=[[0.,1.],[1.,0.]] - >>> ot.sinkhorn(a,b,M,1) + >>> ot.bregman.sinkhorn_epsilon_scaling(a,b,M,1) array([[ 0.36552929, 0.13447071], [ 0.13447071, 0.36552929]]) diff --git a/ot/lp/__init__.py b/ot/lp/__init__.py index 2adf937..1e55f5a 100644 --- a/ot/lp/__init__.py +++ b/ot/lp/__init__.py @@ -45,7 +45,7 @@ def emd(a, b, M): Simple example with obvious solution. The function emd accepts lists and perform automatic conversion to numpy arrays - + >>> import ot >>> a=[.5,.5] >>> b=[.5,.5] >>> M=[[0.,1.],[1.,0.]] diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..cd73c15 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,5 @@ +POT +numpy +scipy +cython +matplotlib diff --git a/test/test_load_module.py b/test/test_load_module.py new file mode 100644 index 0000000..a04c5df --- /dev/null +++ b/test/test_load_module.py @@ -0,0 +1,10 @@ + + +import ot +import doctest + +# test lp solver +doctest.testmod(ot.lp,verbose=True) + +# test bregman solver +doctest.testmod(ot.bregman,verbose=True) diff --git a/travis.yml b/travis.yml new file mode 100644 index 0000000..c73bd8f --- /dev/null +++ b/travis.yml @@ -0,0 +1,16 @@ +language: python +python: + - "2.6" + - "2.7" + - "3.2" + - "3.3" + - "3.4" + # does not have headers provided, please ask https://launchpad.net/~pypy/+archive/ppa + # maintainers to fix their pypy-dev package. + - "pypy" +# command to install dependencies +install: + - pip install . + - pip install -r requirements.txt +# command to run tests +script: pytest |