diff options
author | RĂ©mi Flamary <remi.flamary@gmail.com> | 2020-05-05 10:28:03 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-05-05 10:28:03 +0200 |
commit | 94d5c8cc9046854f473d8e4526a3bcf214eb5411 (patch) | |
tree | 27c620db19e2a01b229f59dda3bdaa65ecac5307 /examples | |
parent | 0497d888884bf1749b7bb944a3f717baff35528e (diff) | |
parent | 20e10a6db35a567d2cc6d75ad659c7473d82d3a7 (diff) |
Merge pull request #167 from PythonOT/doc_v0.7
[WIP] Reproducible example WDA and remove dense from doc
Diffstat (limited to 'examples')
-rw-r--r-- | examples/others/plot_WDA.py | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/examples/others/plot_WDA.py b/examples/others/plot_WDA.py index 5e17433..bdfa57d 100644 --- a/examples/others/plot_WDA.py +++ b/examples/others/plot_WDA.py @@ -33,6 +33,8 @@ from ot.dr import wda, fda n = 1000 # nb samples in source and target datasets nz = 0.2 +np.random.seed(1) + # generate circle dataset t = np.random.rand(n) * 2 * np.pi ys = np.floor((np.arange(n) * 1.0 / n * 3)) + 1 @@ -88,7 +90,11 @@ reg = 1e0 k = 10 maxiter = 100 -Pwda, projwda = wda(xs, ys, p, reg, k, maxiter=maxiter) +P0 = np.random.randn(xs.shape[1], p) + +P0 /= np.sqrt(np.sum(P0**2, 0, keepdims=True)) + +Pwda, projwda = wda(xs, ys, p, reg, k, maxiter=maxiter, P0=P0) ############################################################################## |