Skip to content
Closed
Changes from 1 commit
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
3306f40
GPU changes:
toto6 Sep 13, 2017
93376d5
Fix indent
toto6 Sep 13, 2017
3bf4d09
Remove debug
toto6 Sep 13, 2017
bbe9a92
Remove debug
toto6 Sep 14, 2017
05c1bd6
Small speedup LpL1
toto6 Sep 14, 2017
111d3ff
Merge branch 'master' into master
toto6 Sep 14, 2017
abf6fe0
Add utils functions for CPU/GPU merge
toto6 Sep 19, 2017
d7d25b3
Use function pairwiseEuclidean for dist computation
toto6 Sep 19, 2017
e99328b
Merge https://github.com/rflamary/POT
toto6 Sep 19, 2017
7874570
Initial implementation GPU for sinkhorn
toto6 Sep 19, 2017
6c7012f
Little speedup sinkhorn:
toto6 Sep 19, 2017
eae9d2a
Little speedup sinkhorn:
toto6 Sep 19, 2017
a30f3aa
Move test file
toto6 Sep 19, 2017
23869f8
Fix mistake
toto6 Sep 20, 2017
dcfae03
Replace xp by np
toto6 Sep 20, 2017
9d9d996
Compute sinkhorn using float type of inputs
toto6 Sep 28, 2017
d6157db
Add decorator from Rémi
toto6 Oct 9, 2017
131b711
gpu changes:
toto6 Dec 3, 2017
39275aa
fix some warnings
toto6 Dec 3, 2017
7ad1571
fix mistake
toto6 Dec 3, 2017
0b40b5f
Update gpu test file
toto6 Dec 3, 2017
cb739f6
add linear mapping function
rflamary Mar 20, 2018
8fc9fce
add class LinearTransport
rflamary Mar 20, 2018
c104623
passing tests
rflamary Mar 20, 2018
4fc9ccc
better example+test
rflamary Mar 20, 2018
88a81c3
makefile update
rflamary Mar 20, 2018
287c659
update example
rflamary Mar 20, 2018
6fdf5de
add linear mapping test + autopep8
rflamary Mar 21, 2018
5efdf00
add test linear mapping class
rflamary Mar 21, 2018
fc9923d
add tests for ot.uils
rflamary Mar 21, 2018
927395b
add externals for function signature
rflamary Mar 21, 2018
55aaf78
add test gromov + debug sklearn Basestimator
rflamary Mar 21, 2018
64ef33d
aupdate gromov + autopep8 externals
rflamary Mar 21, 2018
7095e03
gtomov barycenter tests
rflamary Mar 21, 2018
63fd11e
add entropic gromov test for 90+% corerage
rflamary Mar 21, 2018
1262563
update readme + doc
rflamary Mar 21, 2018
0ce1a5e
update doc
rflamary Mar 21, 2018
83c706c
pep cleanup
rflamary Mar 21, 2018
69c7d1c
pep8 unused variable
rflamary Mar 21, 2018
7681db5
update reame
rflamary Mar 21, 2018
aa12256
add automatically documentation to gu_fun
rflamary May 2, 2018
aa24c1d
pep8 util function
rflamary May 2, 2018
6f964e4
better decorate
rflamary May 2, 2018
0bec096
awesome merge
rflamary May 2, 2018
90636c4
working decorator for gpu
rflamary May 2, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
add tests for ot.uils
  • Loading branch information
rflamary committed Mar 21, 2018
commit fc9923dea2706b65ffe15fc86428cd8b53b5feb1
77 changes: 77 additions & 0 deletions test/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

import ot
import numpy as np
import sys


def test_parmap():
Expand Down Expand Up @@ -123,3 +124,79 @@ def test_clean_zeros():

assert len(a) == n - nz
assert len(b) == n - nz2


def test_cost_normalization():

C = np.random.rand(10, 10)

# does nothing
M0 = ot.utils.cost_normalization(C)
np.testing.assert_allclose(C, M0)

M = ot.utils.cost_normalization(C, 'median')
np.testing.assert_allclose(np.median(M), 1)

M = ot.utils.cost_normalization(C, 'max')
np.testing.assert_allclose(M.max(), 1)

M = ot.utils.cost_normalization(C, 'log')
np.testing.assert_allclose(M.max(), np.log(1 + C).max())

M = ot.utils.cost_normalization(C, 'loglog')
np.testing.assert_allclose(M.max(), np.log(1 + np.log(1 + C)).max())


def test_check_params():

res1 = ot.utils.check_params(first='OK', second=20)
assert res1 is True

res0 = ot.utils.check_params(first='OK', second=None)
assert res0 is False


def test_deprecated_func():

@ot.utils.deprecated('deprecated text for fun')
def fun():
pass

def fun2():
pass

@ot.utils.deprecated('deprecated text for class')
class Class():
pass

if sys.version_info < (3, 5):
print('Not tested')
else:
assert ot.utils._is_deprecated(fun) is True

assert ot.utils._is_deprecated(fun2) is False


def test_BaseEstimator():

class Class(ot.utils.BaseEstimator):

def __init__(self, first='spam', second='eggs'):

self.first = first
self.second = second

cl = Class()

names = cl._get_param_names()
assert 'first' in names
assert 'second' in names

params = cl.get_params()
assert 'first' in params
assert 'second' in params

params['first'] = 'spam again'
cl.set_params(**params)

assert cl.first == 'spam again'