Skip to content
Merged
Changes from 1 commit
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
d6ef867
remove jcpot from laplace
Apr 8, 2020
4d77cc9
pep test da
Apr 8, 2020
25cad19
pep test da
Apr 8, 2020
37412f5
remove blank line
Apr 8, 2020
7c99409
Merge branch 'master' into laplace_da
Apr 8, 2020
93ef47c
description example laplacian
Apr 15, 2020
4130a91
Merge branch 'laplace_da' of https://github.com/ievred/POT into lapla…
Apr 15, 2020
77cae32
check conflict da
Apr 15, 2020
dda4941
conflict readme
Apr 15, 2020
ef50bae
readme
Apr 15, 2020
33ba700
readme conflict
Apr 15, 2020
7b98abf
conflict readme
Apr 15, 2020
2571a3e
conflict test_da
Apr 15, 2020
f9499dc
Merge branch 'master' into laplace_da
Apr 15, 2020
1c60175
conflict test_da
Apr 15, 2020
6c64f16
import laplacian
Apr 15, 2020
14fbb88
references added
Apr 16, 2020
1269033
added regulrization from [6]+fix other issues
Apr 17, 2020
0746328
added kwargs to sim + doc
Apr 20, 2020
4eeaf49
conflit readme
Apr 20, 2020
5eedfcf
conflit readme
Apr 20, 2020
6da7586
conflit readme
Apr 20, 2020
72b1a28
conflit readme
Apr 20, 2020
d25d9e8
conflit readme
Apr 20, 2020
6ea4169
clean readme
Apr 20, 2020
d12ccc2
clean readme
Apr 20, 2020
55b5da6
hell
Apr 20, 2020
3409778
hell
Apr 20, 2020
e3d6660
Merge branch 'master' into laplace_da
Apr 20, 2020
1a36193
readme with laplace
Apr 20, 2020
fd115a5
sim+sim param fixed
Apr 20, 2020
36b2e92
added defaults for emd_laplace
Apr 20, 2020
b706bad
Change rflamary to PythonOT in Readme
rflamary Apr 20, 2020
470fce2
added defaults for emd_laplace
Apr 20, 2020
a4426fd
Merge branch 'master' into laplace_da
rflamary Apr 20, 2020
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
conflict test_da
  • Loading branch information
ievred committed Apr 15, 2020
commit 1c60175fee4eb7f29b49f693e91f59720369edb1
64 changes: 64 additions & 0 deletions test/test_da.py
Original file line number Diff line number Diff line change
Expand Up @@ -689,3 +689,67 @@ def test_jcpot_barycenter():
numItermax=10000, stopThr=1e-9, verbose=False, log=False)

np.testing.assert_allclose(prop, [1 - pt, pt], rtol=1e-3, atol=1e-3)


def test_emd_laplace_class():
"""test_emd_laplace_transport
"""
ns = 150
nt = 200

Xs, ys = make_data_classif('3gauss', ns)
Xt, yt = make_data_classif('3gauss2', nt)

otda = ot.da.EMDLaplaceTransport(reg_lap=0.01, max_iter=1000, tol=1e-9, verbose=False, log=True)

# test its computed
otda.fit(Xs=Xs, ys=ys, Xt=Xt)

assert hasattr(otda, "coupling_")
assert hasattr(otda, "log_")

# test dimensions of coupling
assert_equal(otda.coupling_.shape, ((Xs.shape[0], Xt.shape[0])))

# test all margin constraints
mu_s = unif(ns)
mu_t = unif(nt)

assert_allclose(
np.sum(otda.coupling_, axis=0), mu_t, rtol=1e-3, atol=1e-3)
assert_allclose(
np.sum(otda.coupling_, axis=1), mu_s, rtol=1e-3, atol=1e-3)

# test transform
transp_Xs = otda.transform(Xs=Xs)
[assert_equal(x.shape, y.shape) for x, y in zip(transp_Xs, Xs)]

Xs_new, _ = make_data_classif('3gauss', ns + 1)
transp_Xs_new = otda.transform(Xs_new)

# check that the oos method is working
assert_equal(transp_Xs_new.shape, Xs_new.shape)

# test inverse transform
transp_Xt = otda.inverse_transform(Xt=Xt)
assert_equal(transp_Xt.shape, Xt.shape)

Xt_new, _ = make_data_classif('3gauss2', nt + 1)
transp_Xt_new = otda.inverse_transform(Xt=Xt_new)

# check that the oos method is working
assert_equal(transp_Xt_new.shape, Xt_new.shape)

# test fit_transform
transp_Xs = otda.fit_transform(Xs=Xs, Xt=Xt)
assert_equal(transp_Xs.shape, Xs.shape)

# check label propagation
transp_yt = otda.transform_labels(ys)
assert_equal(transp_yt.shape[0], yt.shape[0])
assert_equal(transp_yt.shape[1], len(np.unique(ys)))

# check inverse label propagation
transp_ys = otda.inverse_transform_labels(yt)
assert_equal(transp_ys.shape[0], ys.shape[0])
assert_equal(transp_ys.shape[1], len(np.unique(yt)))