Skip to content

Commit 217ffbb

Browse files
committed
cleanup WDA example with proper seeds
1 parent 0a1e8cd commit 217ffbb

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

examples/others/plot_WDA.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@
3333
n = 1000 # nb samples in source and target datasets
3434
nz = 0.2
3535

36+
np.random.RandomState(1)
37+
3638
# generate circle dataset
3739
t = np.random.rand(n) * 2 * np.pi
3840
ys = np.floor((np.arange(n) * 1.0 / n * 3)) + 1
@@ -88,7 +90,11 @@
8890
k = 10
8991
maxiter = 100
9092

91-
Pwda, projwda = wda(xs, ys, p, reg, k, maxiter=maxiter)
93+
P0 = np.random.randn(xs.shape[1], p)
94+
95+
P0 /= np.sqrt(np.sum(P0**2, 0, keepdims=True))
96+
97+
Pwda, projwda = wda(xs, ys, p, reg, k, maxiter=maxiter, P0=P0)
9298

9399

94100
##############################################################################

0 commit comments

Comments
 (0)