diff options
author | RĂ©mi Flamary <remi.flamary@gmail.com> | 2018-10-03 08:38:11 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-10-03 08:38:11 +0200 |
commit | feaecbe2965fa22cdf964c2e869fe56d6ce392e9 (patch) | |
tree | e591f016a12b00c17a065b4e5881b0d5c24135fd /ot | |
parent | 8f6c45534dcdd6e8f80a31205be28481fc79c533 (diff) | |
parent | 27f0a9fe625f6fa8123e0e7364a4c0c0e10d5702 (diff) |
Merge pull request #63 from rflamary/prV0.5
[MRG] Release 0.5
Diffstat (limited to 'ot')
-rw-r--r-- | ot/__init__.py | 2 | ||||
-rw-r--r-- | ot/datasets.py | 4 | ||||
-rw-r--r-- | ot/gpu/__init__.py | 17 | ||||
-rw-r--r-- | ot/gpu/da.py | 3 |
4 files changed, 15 insertions, 11 deletions
diff --git a/ot/__init__.py b/ot/__init__.py index 1dde390..b27541d 100644 --- a/ot/__init__.py +++ b/ot/__init__.py @@ -29,7 +29,7 @@ from .da import sinkhorn_lpl1_mm # utils functions from .utils import dist, unif, tic, toc, toq -__version__ = "0.4.0" +__version__ = "0.5.0" __all__ = ["emd", "emd2", "sinkhorn", "sinkhorn2", "utils", 'datasets', 'bregman', 'lp', 'tic', 'toc', 'toq', 'gromov', diff --git a/ot/datasets.py b/ot/datasets.py index 362a89b..e76e75d 100644 --- a/ot/datasets.py +++ b/ot/datasets.py @@ -38,9 +38,9 @@ def make_1D_gauss(n, m, s): @deprecated() -def get_1D_gauss(n, m, sigma, random_state=None): +def get_1D_gauss(n, m, sigma): """ Deprecated see make_1D_gauss """ - return make_1D_gauss(n, m, sigma, random_state=None) + return make_1D_gauss(n, m, sigma) def make_2D_samples_gauss(n, m, sigma, random_state=None): diff --git a/ot/gpu/__init__.py b/ot/gpu/__init__.py index 0187a4f..deda6b1 100644 --- a/ot/gpu/__init__.py +++ b/ot/gpu/__init__.py @@ -9,15 +9,17 @@ By default, the functions in this module accept and return numpy arrays in order to proide drop-in replacement for the other POT function but the transfer between CPU en GPU comes with a significant overhead. -In order to get the best erformances, we recommend to given only cupy +In order to get the best erformances, we recommend to give only cupy arrays to the functions and desactivate the conversion to numpy of the result of the function with parameter ``to_numpy=False``. - - - """ +# Author: Remi Flamary <remi.flamary@unice.fr> +# Leo Gautheron <https://github.com/aje> +# +# License: MIT License + from . import bregman from . import da from .bregman import sinkhorn @@ -27,10 +29,9 @@ from . import utils from .utils import dist, to_gpu, to_np -# Author: Remi Flamary <remi.flamary@unice.fr> -# Leo Gautheron <https://github.com/aje> -# -# License: MIT License + + __all__ = ["utils", "dist", "sinkhorn", "sinkhorn_lpl1_mm", 'bregman', 'da', 'to_gpu', 'to_np'] + diff --git a/ot/gpu/da.py b/ot/gpu/da.py index 6aba29c..4a98038 100644 --- a/ot/gpu/da.py +++ b/ot/gpu/da.py @@ -10,10 +10,12 @@ Domain adaptation with optimal transport with GPU implementation # # License: MIT License + import cupy as np # np used for matrix computation import cupy as cp # cp used for cupy specific operations import numpy as npp from . import utils + from .bregman import sinkhorn @@ -131,6 +133,7 @@ def sinkhorn_lpl1_mm(a, labels_a, b, M, reg, eta=0.1, numItermax=10, # separated W = np.ones(M.shape) for (i, c) in enumerate(classes): + majs = np.sum(transp[indices_labels[i]], axis=0) majs = p * ((majs + epsilon)**(p - 1)) W[indices_labels[i]] = majs |