Skip to content

Commit 347e628

Browse files
committed
n to n_samples
1 parent 67b011a commit 347e628

File tree

2 files changed

+14
-22
lines changed

2 files changed

+14
-22
lines changed

test/test_da.py

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,15 @@
33
import ot
44

55

6-
# import pytest
7-
8-
96
def test_otda():
107

11-
n = 150 # nb samples
8+
n_samples = 150 # nb samples
129
np.random.seed(0)
1310

14-
xs, ys = ot.datasets.get_data_classif('3gauss', n)
15-
xt, yt = ot.datasets.get_data_classif('3gauss2', n)
11+
xs, ys = ot.datasets.get_data_classif('3gauss', n_samples)
12+
xt, yt = ot.datasets.get_data_classif('3gauss2', n_samples)
1613

17-
a, b = ot.unif(n), ot.unif(n)
14+
a, b = ot.unif(n_samples), ot.unif(n_samples)
1815

1916
# LP problem
2017
da_emd = ot.da.OTDA() # init class

test/test_dr.py

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,15 @@
1313
@pytest.mark.skipif(nogo, reason="Missing modules (autograd or pymanopt)")
1414
def test_fda():
1515

16-
n = 90 # nb samples in source and target datasets
16+
n_samples = 90 # nb samples in source and target datasets
1717
np.random.seed(0)
1818

19-
# generate circle dataset
20-
xs, ys = ot.datasets.get_data_classif('gaussrot', n)
19+
# generate gaussian dataset
20+
xs, ys = ot.datasets.get_data_classif('gaussrot', n_samples)
2121

22-
nbnoise = 8
22+
n_features_noise = 8
2323

24-
xs = np.hstack((xs, np.random.randn(n, nbnoise)))
24+
xs = np.hstack((xs, np.random.randn(n_samples, n_features_noise)))
2525

2626
p = 1
2727

@@ -35,20 +35,15 @@ def test_fda():
3535
@pytest.mark.skipif(nogo, reason="Missing modules (autograd or pymanopt)")
3636
def test_wda():
3737

38-
n = 100 # nb samples in source and target datasets
39-
nz = 0.2
38+
n_samples = 100 # nb samples in source and target datasets
4039
np.random.seed(0)
4140

42-
# generate circle dataset
43-
t = np.random.rand(n) * 2 * np.pi
44-
ys = np.floor((np.arange(n) * 1.0 / n * 3)) + 1
45-
xs = np.concatenate(
46-
(np.cos(t).reshape((-1, 1)), np.sin(t).reshape((-1, 1))), 1)
47-
xs = xs * ys.reshape(-1, 1) + nz * np.random.randn(n, 2)
41+
# generate gaussian dataset
42+
xs, ys = ot.datasets.get_data_classif('gaussrot', n_samples)
4843

49-
nbnoise = 8
44+
n_features_noise = 8
5045

51-
xs = np.hstack((xs, np.random.randn(n, nbnoise)))
46+
xs = np.hstack((xs, np.random.randn(n_samples, n_features_noise)))
5247

5348
p = 2
5449

0 commit comments

Comments
 (0)