Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 5e70a77

Browse files
Merge pull request #91 from rflamary/v1.0
[MRG] Release 0.6
2 parents f251b4d + 29848c2 commit 5e70a77

File tree

10 files changed

+160
-49
lines changed

10 files changed

+160
-49
lines changed

‎.travis.yml‎

Lines changed: 28 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,35 @@
1+
dist: xenial # required for Python >= 3.7
12
language: python
23
matrix:
3-
# allow_failures:
4-
# - os: osx
5-
include:
6-
# - os: osx
7-
# language: generic
8-
- os: linux
9-
sudo: required
10-
python: 3.4
11-
- os: linux
12-
sudo: required
13-
python: 3.5
14-
- os: linux
15-
sudo: required
16-
python: 3.6
17-
- os: linux
18-
sudo: required
19-
python: 2.7
4+
# allow_failures:
5+
# - os: osx
6+
# - os: windows
7+
include:
8+
- os: linux
9+
sudo: required
10+
python: 3.5
11+
- os: linux
12+
sudo: required
13+
python: 3.6
14+
- os: linux
15+
sudo: required
16+
python: 3.7
17+
- os: linux
18+
sudo: required
19+
python: 2.7
20+
# - os: osx
21+
# sudo: required
22+
# language: generic
23+
# - name: "Python 3.7.3 on Windows"
24+
# os: windows # Windows 10.0.17134 N/A Build 17134
25+
# language: shell # 'language: python' is an error on Travis CI Windows
26+
# before_install: choco install python
27+
# env: PATH=/c/Python37:/c/Python37/Scripts:$PATH
28+
# before_script: # configure a headless display to test plot generation
29+
# - "export DISPLAY=:99.0"
30+
# - sleep 3 # give xvfb some time to start
2031
before_install:
2132
- ./.travis/before_install.sh
22-
before_script: # configure a headless display to test plot generation
23-
- "export DISPLAY=:99.0"
24-
- sleep 3 # give xvfb some time to start
2533
# command to install dependencies
2634
install:
2735
- pip install -r requirements.txt

‎MANIFEST.in‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
graft ot/lp/
21
include README.md
2+
include RELEASES.md
33
include LICENSE
44
include ot/lp/core.h
55
include ot/lp/EMD.h

‎Makefile‎

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
PYTHON=python3
44
branch := $(shell git symbolic-ref --short -q HEAD)
55

6+
7+
68
help :
79
@echo "The following make targets are available:"
810
@echo " help - print this message"
@@ -13,6 +15,7 @@ help :
1315
@echo " sremove - remove the package (system with sudo)"
1416
@echo " clean - remove any temporary files"
1517
@echo " notebook - launch ipython notebook"
18+
1619
build :
1720
$(PYTHON) setup.py build
1821

@@ -47,14 +50,15 @@ test : FORCE pep8
4750
pytest : FORCE
4851
$(PYTHON) -m pytest -v test/ --doctest-modules --ignore ot/gpu/ --cov=ot
4952

50-
uploadpypi :
51-
#python setup.py register
52-
$(PYTHON) setup.py sdist upload -r pypi
53+
release :
54+
twine upload dist/*
55+
56+
release_test :
57+
twine upload --repository-url https://test.pypi.org/legacy/ dist/*
5358

5459
rdoc :
5560
pandoc --from=markdown --to=rst --output=docs/source/readme.rst README.md
5661

57-
5862
notebook :
5963
ipython notebook --matplotlib=inline --notebook-dir=notebooks/
6064

@@ -73,6 +77,13 @@ autopep8 :
7377

7478
aautopep8 :
7579
autopep8 -air test ot examples --jobs -1
80+
81+
wheels :
82+
CIBW_BEFORE_BUILD="pip install numpy cython" cibuildwheel --platform linux --output-dir dist
83+
84+
dist : wheels
85+
$(PYTHON) setup.py sdist
86+
7687

7788
pydocstyle :
7889
pydocstyle ot

‎README.md‎

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ year={2017}
4545

4646
## Installation
4747

48-
The library has been tested on Linux, MacOSX and Windows. It requires a C++ compiler for using the EMD solver and relies on the following Python modules:
48+
The library has been tested on Linux, MacOSX and Windows. It requires a C++ compiler for building/installing the EMD solver and relies on the following Python modules:
4949

5050
- Numpy (>=1.11)
5151
- Scipy (>=1.0)
@@ -152,7 +152,8 @@ Here is a list of the Python notebooks available [here](https://github.com/rflam
152152
* [Wasserstein Discriminant Analysis](https://github.com/rflamary/POT/blob/master/notebooks/plot_WDA.ipynb)
153153
* [Gromov Wasserstein](https://github.com/rflamary/POT/blob/master/notebooks/plot_gromov.ipynb)
154154
* [Gromov Wasserstein Barycenter](https://github.com/rflamary/POT/blob/master/notebooks/plot_gromov_barycenter.ipynb)
155-
155+
* [Fused Gromov Wasserstein](https://github.com/rflamary/POT/blob/master/notebooks/plot_fgw.ipynb)
156+
* [Fused Gromov Wasserstein Barycenter](https://github.com/rflamary/POT/blob/master/notebooks/plot_barycenter_fgw.ipynb)
156157

157158

158159
You can also see the notebooks with [Jupyter nbviewer](https://nbviewer.jupyter.org/github/rflamary/POT/tree/master/notebooks/).
@@ -166,8 +167,6 @@ This toolbox has been created and is maintained by
166167

167168
The contributors to this library are
168169

169-
* [Rémi Flamary](http://remi.flamary.com/)
170-
* [Nicolas Courty](http://people.irisa.fr/Nicolas.Courty/)
171170
* [Alexandre Gramfort](http://alexandre.gramfort.net/)
172171
* [Laetitia Chapel](http://people.irisa.fr/Laetitia.Chapel/)
173172
* [Michael Perrot](http://perso.univ-st-etienne.fr/pem82055/) (Mapping estimation)

‎RELEASES.md‎

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,74 @@
11
# POT Releases
22

33

4+
## 0.6 Year 3
5+
*July 2019*
6+
7+
This is the first official stable release of POT and this means a jump to 0.6!
8+
The library has been used in
9+
the wild for a while now and we have reached a state where a lot of fundamental
10+
OT solvers are available and tested. It has been quite stable in the last months
11+
but kept the beta flag in its Pypi classifiers until now.
12+
13+
Note that this release will be the last one supporting officially Python 2.7 (See
14+
https://python3statement.org/ for more reasons). For next release we will keep
15+
the travis tests for Python 2 but will make them non necessary for merge in 2020.
16+
17+
The features are never complete in a toolbox designed for solving mathematical
18+
problems and research but with the new contributions we now implement algorithms and solvers
19+
from 24 scientific papers (listed in the README.md file). New features include a
20+
direct implementation of the [empirical Sinkhorn divergence](https://pot.readthedocs.io/en/latest/all.html#ot.bregman.empirical_sinkhorn_divergence)
21+
, a new efficient (Cython implementation) solver for [EMD in 1D](https://pot.readthedocs.io/en/latest/all.html#ot.lp.emd_1d)
22+
and corresponding [Wasserstein
23+
1D](https://pot.readthedocs.io/en/latest/all.html#ot.lp.wasserstein_1d). We now also
24+
have implementations for [Unbalanced OT](https://github.com/rflamary/POT/blob/master/notebooks/plot_UOT_1D.ipynb)
25+
and a solver for [Unbalanced OT barycenters](https://github.com/rflamary/POT/blob/master/notebooks/plot_UOT_barycenter_1D.ipynb).
26+
A new variant of Gromov-Wasserstein divergence called [Fused
27+
Gromov-Wasserstein](https://pot.readthedocs.io/en/latest/all.html?highlight=fused_#ot.gromov.fused_gromov_wasserstein)
28+
has been also contributed with exemples of use on [structured data](https://github.com/rflamary/POT/blob/master/notebooks/plot_fgw.ipynb)
29+
and computing [barycenters of labeld graphs](https://github.com/rflamary/POT/blob/master/notebooks/plot_barycenter_fgw.ipynb).
30+
31+
32+
A lot of work has been done on the documentation with several new
33+
examples corresponding to the new features and a lot of corrections for the
34+
docstrings. But the most visible change is a new
35+
[quick start guide](https://pot.readthedocs.io/en/latest/quickstart.html) for
36+
POT that gives several pointers about which function or classes allow to solve which
37+
specific OT problem. When possible a link is provided to relevant examples.
38+
39+
We will also provide with this release some pre-compiled Python wheels for Linux
40+
64bit on
41+
github and pip. This will simplify the install process that before required a C
42+
compiler and numpy/cython already installed.
43+
44+
Finally we would like to acknowledge and thank the numerous contributors of POT
45+
that has helped in the past build the foundation and are still contributing to
46+
bring new features and solvers to the library.
47+
48+
49+
50+
#### Features
51+
52+
* Add compiled manylinux 64bits wheels to pip releases (PR #91)
53+
* Add quick start guide (PR #88)
54+
* Make doctest work on travis (PR #90)
55+
* Update documentation (PR #79, PR #84)
56+
* Solver for EMD in 1D (PR #89)
57+
* Solvers for regularized unbalanced OT (PR #87, PR#99)
58+
* Solver for Fused Gromov-Wasserstein (PR #86)
59+
* Add empirical Sinkhorn and empirical Sinkhorn divergences (PR #80)
60+
61+
62+
#### Closed issues
63+
64+
- Issue #59 fail when using "pip install POT" (new details in doc+ hopefully
65+
wheels)
66+
- Issue #85 Cannot run gpu modules
67+
- Issue #75 Greenkhorn do not return log (solved in PR #76)
68+
- Issue #82 Gromov-Wasserstein fails when the cost matrices are slightly different
69+
- Issue #72 Macosx build problem
70+
71+
472
## 0.5.0 Year 2
573
*Sep 2018*
674

‎ot/__init__.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,9 @@
7171
# utils functions
7272
from .utils import dist, unif, tic, toc, toq
7373

74-
__version__ = "0.5.1"
74+
__version__ = "0.6.0"
7575

76-
__all__ = ["emd", "emd2", 'emd_1d', "sinkhorn", "sinkhorn2", "utils", 'datasets',
76+
__all__ = ['emd', 'emd2', 'emd_1d', 'sinkhorn', 'sinkhorn2', 'utils', 'datasets',
7777
'bregman', 'lp', 'tic', 'toc', 'toq', 'gromov',
7878
'emd_1d', 'emd2_1d', 'wasserstein_1d',
7979
'dist', 'unif', 'barycenter', 'sinkhorn_lpl1_mm', 'da', 'optim',

‎ot/lp/__init__.py‎

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
# License: MIT License
1212

1313
import multiprocessing
14-
14+
importsys
1515
import numpy as np
1616
from scipy.sparse import coo_matrix
1717

@@ -151,6 +151,8 @@ def emd2(a, b, M, processes=multiprocessing.cpu_count(),
151151
Target histogram (uniform weight if empty list)
152152
M : (ns,nt) numpy.ndarray, float64
153153
Loss matrix (c-order array with type float64)
154+
processes : int, optional (default=nb cpu)
155+
Nb of processes used for multiple emd computation (not used on windows)
154156
numItermax : int, optional (default=100000)
155157
The maximum number of iterations before stopping the optimization
156158
algorithm if it has not converged.
@@ -200,6 +202,10 @@ def emd2(a, b, M, processes=multiprocessing.cpu_count(),
200202
b = np.asarray(b, dtype=np.float64)
201203
M = np.asarray(M, dtype=np.float64)
202204

205+
# problem with pikling Forks
206+
if sys.platform.endswith('win32'):
207+
processes=1
208+
203209
# if empty array given then use uniform distributions
204210
if len(a) == 0:
205211
a = np.ones((M.shape[0],), dtype=np.float64) / M.shape[0]
@@ -228,7 +234,11 @@ def f(b):
228234
return f(b)
229235
nb = b.shape[1]
230236

231-
res = parmap(f, [b[:, i] for i in range(nb)], processes)
237+
if processes>1:
238+
res = parmap(f, [b[:, i] for i in range(nb)], processes)
239+
else:
240+
res = list(map(f, [b[:, i].copy() for i in range(nb)]))
241+
232242
return res
233243

234244

‎ot/utils.py‎

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -210,23 +210,28 @@ def fun(f, q_in, q_out):
210210

211211

212212
def parmap(f, X, nprocs=multiprocessing.cpu_count()):
213-
""" paralell map for multiprocessing """
214-
q_in = multiprocessing.Queue(1)
215-
q_out = multiprocessing.Queue()
213+
""" paralell map for multiprocessing (only map on windows)"""
216214

217-
proc = [multiprocessing.Process(target=fun, args=(f, q_in, q_out))
218-
for _ in range(nprocs)]
219-
for p in proc:
220-
p.daemon = True
221-
p.start()
215+
if not sys.platform.endswith('win32'):
222216

223-
sent = [q_in.put((i, x)) for i, x in enumerate(X)]
224-
[q_in.put((None, None)) for _ in range(nprocs)]
225-
res = [q_out.get() for _ in range(len(sent))]
217+
q_in = multiprocessing.Queue(1)
218+
q_out = multiprocessing.Queue()
226219

227-
[p.join() for p in proc]
220+
proc = [multiprocessing.Process(target=fun, args=(f, q_in, q_out))
221+
for _ in range(nprocs)]
222+
for p in proc:
223+
p.daemon = True
224+
p.start()
228225

229-
return [x for i, x in sorted(res)]
226+
sent = [q_in.put((i, x)) for i, x in enumerate(X)]
227+
[q_in.put((None, None)) for _ in range(nprocs)]
228+
res = [q_out.get() for _ in range(len(sent))]
229+
230+
[p.join() for p in proc]
231+
232+
return [x for i, x in sorted(res)]
233+
else:
234+
return list(map(f, X))
230235

231236

232237
def check_params(**kwargs):

‎requirements.txt‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,5 @@ matplotlib
55
sphinx-gallery
66
autograd
77
pymanopt
8+
cvxopt
89
pytest

‎setup.py‎

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,17 +53,26 @@
5353
license = 'MIT',
5454
scripts=[],
5555
data_files=[],
56-
requires=["numpy","scipy","cython","matplotlib"],
57-
install_requires=["numpy","scipy","cython","matplotlib"],
56+
requires=["numpy","scipy","cython"],
57+
install_requires=["numpy","scipy","cython"],
5858
classifiers=[
59-
'Development Status :: 4 - Beta',
59+
'Development Status :: 5 - Production/Stable',
6060
'Intended Audience :: Developers',
61+
'Intended Audience :: Education',
62+
'Intended Audience :: Science/Research',
63+
'License :: OSI Approved :: MIT License',
6164
'Environment :: Console',
6265
'Operating System :: OS Independent',
6366
'Operating System :: MacOS',
6467
'Operating System :: POSIX',
6568
'Programming Language :: Python',
69+
'Programming Language :: C++',
70+
'Programming Language :: C',
71+
'Programming Language :: Cython',
6672
'Topic :: Utilities',
73+
'Topic :: Scientific/Engineering :: Artificial Intelligence',
74+
'Topic :: Scientific/Engineering :: Mathematics',
75+
'Topic :: Scientific/Engineering :: Information Analysis',
6776
'Programming Language :: Python :: 2',
6877
'Programming Language :: Python :: 2.7',
6978
'Programming Language :: Python :: 3',

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /