Skip to content

Commit 788a650

Browse files
committed
seed
1 parent ad450b0 commit 788a650

File tree

1 file changed

+9
-17
lines changed

1 file changed

+9
-17
lines changed

test/test_gromov.py

Lines changed: 9 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,12 @@
1111

1212

1313
def test_gromov():
14-
np.random.seed(42)
15-
1614
n_samples = 50 # nb samples
1715

1816
mu_s = np.array([0, 0])
1917
cov_s = np.array([[1, 0], [0, 1]])
2018

21-
xs = ot.datasets.make_2D_samples_gauss(n_samples, mu_s, cov_s)
19+
xs = ot.datasets.make_2D_samples_gauss(n_samples, mu_s, cov_s, random_state=4)
2220

2321
xt = xs[::-1].copy()
2422

@@ -58,14 +56,12 @@ def test_gromov():
5856

5957

6058
def test_entropic_gromov():
61-
np.random.seed(42)
62-
6359
n_samples = 50 # nb samples
6460

6561
mu_s = np.array([0, 0])
6662
cov_s = np.array([[1, 0], [0, 1]])
6763

68-
xs = ot.datasets.make_2D_samples_gauss(n_samples, mu_s, cov_s)
64+
xs = ot.datasets.make_2D_samples_gauss(n_samples, mu_s, cov_s, random_state=42)
6965

7066
xt = xs[::-1].copy()
7167

@@ -102,13 +98,11 @@ def test_entropic_gromov():
10298

10399

104100
def test_gromov_barycenter():
105-
np.random.seed(42)
106-
107101
ns = 50
108102
nt = 60
109103

110-
Xs, ys = ot.datasets.make_data_classif('3gauss', ns)
111-
Xt, yt = ot.datasets.make_data_classif('3gauss2', nt)
104+
Xs, ys = ot.datasets.make_data_classif('3gauss', ns, random_state=42)
105+
Xt, yt = ot.datasets.make_data_classif('3gauss2', nt, random_state=42)
112106

113107
C1 = ot.dist(Xs)
114108
C2 = ot.dist(Xt)
@@ -131,12 +125,11 @@ def test_gromov_barycenter():
131125

132126

133127
def test_gromov_entropic_barycenter():
134-
np.random.seed(42)
135128
ns = 50
136129
nt = 60
137130

138-
Xs, ys = ot.datasets.make_data_classif('3gauss', ns)
139-
Xt, yt = ot.datasets.make_data_classif('3gauss2', nt)
131+
Xs, ys = ot.datasets.make_data_classif('3gauss', ns, random_state=42)
132+
Xt, yt = ot.datasets.make_data_classif('3gauss2', nt, random_state=42)
140133

141134
C1 = ot.dist(Xs)
142135
C2 = ot.dist(Xt)
@@ -159,14 +152,13 @@ def test_gromov_entropic_barycenter():
159152

160153

161154
def test_fgw():
162-
np.random.seed(42)
163155

164156
n_samples = 50 # nb samples
165157

166158
mu_s = np.array([0, 0])
167159
cov_s = np.array([[1, 0], [0, 1]])
168160

169-
xs = ot.datasets.make_2D_samples_gauss(n_samples, mu_s, cov_s)
161+
xs = ot.datasets.make_2D_samples_gauss(n_samples, mu_s, cov_s, random_state=42)
170162

171163
xt = xs[::-1].copy()
172164

@@ -217,8 +209,8 @@ def test_fgw_barycenter():
217209
ns = 50
218210
nt = 60
219211

220-
Xs, ys = ot.datasets.make_data_classif('3gauss', ns)
221-
Xt, yt = ot.datasets.make_data_classif('3gauss2', nt)
212+
Xs, ys = ot.datasets.make_data_classif('3gauss', ns, random_state=42)
213+
Xt, yt = ot.datasets.make_data_classif('3gauss2', nt, random_state=42)
222214

223215
ys = np.random.randn(Xs.shape[0], 2)
224216
yt = np.random.randn(Xt.shape[0], 2)

0 commit comments

Comments
 (0)