summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorRémi Flamary <remi.flamary@gmail.com>2017-07-26 11:42:35 +0200
committerRémi Flamary <remi.flamary@gmail.com>2017-07-26 11:42:35 +0200
commit347e6288b87cbeef9b8fbc1a08cd130b96de1d61 (patch)
tree1d2dbc4faea4d74e1401bf2ff278e697ef214d01 /test
parent67b011a2a6a0cb8dffbb7a2619875f0e0d79588c (diff)
n to n_samples
Diffstat (limited to 'test')
-rw-r--r--test/test_da.py11
-rw-r--r--test/test_dr.py25
2 files changed, 14 insertions, 22 deletions
diff --git a/test/test_da.py b/test/test_da.py
index 8df4795..a38390f 100644
--- a/test/test_da.py
+++ b/test/test_da.py
@@ -3,18 +3,15 @@ import numpy as np
import ot
-# import pytest
-
-
def test_otda():
- n = 150 # nb samples
+ n_samples = 150 # nb samples
np.random.seed(0)
- xs, ys = ot.datasets.get_data_classif('3gauss', n)
- xt, yt = ot.datasets.get_data_classif('3gauss2', n)
+ xs, ys = ot.datasets.get_data_classif('3gauss', n_samples)
+ xt, yt = ot.datasets.get_data_classif('3gauss2', n_samples)
- a, b = ot.unif(n), ot.unif(n)
+ a, b = ot.unif(n_samples), ot.unif(n_samples)
# LP problem
da_emd = ot.da.OTDA() # init class
diff --git a/test/test_dr.py b/test/test_dr.py
index 3faba48..e3d1e6b 100644
--- a/test/test_dr.py
+++ b/test/test_dr.py
@@ -13,15 +13,15 @@ except ImportError:
@pytest.mark.skipif(nogo, reason="Missing modules (autograd or pymanopt)")
def test_fda():
- n = 90 # nb samples in source and target datasets
+ n_samples = 90 # nb samples in source and target datasets
np.random.seed(0)
- # generate circle dataset
- xs, ys = ot.datasets.get_data_classif('gaussrot', n)
+ # generate gaussian dataset
+ xs, ys = ot.datasets.get_data_classif('gaussrot', n_samples)
- nbnoise = 8
+ n_features_noise = 8
- xs = np.hstack((xs, np.random.randn(n, nbnoise)))
+ xs = np.hstack((xs, np.random.randn(n_samples, n_features_noise)))
p = 1
@@ -35,20 +35,15 @@ def test_fda():
@pytest.mark.skipif(nogo, reason="Missing modules (autograd or pymanopt)")
def test_wda():
- n = 100 # nb samples in source and target datasets
- nz = 0.2
+ n_samples = 100 # nb samples in source and target datasets
np.random.seed(0)
- # generate circle dataset
- t = np.random.rand(n) * 2 * np.pi
- ys = np.floor((np.arange(n) * 1.0 / n * 3)) + 1
- xs = np.concatenate(
- (np.cos(t).reshape((-1, 1)), np.sin(t).reshape((-1, 1))), 1)
- xs = xs * ys.reshape(-1, 1) + nz * np.random.randn(n, 2)
+ # generate gaussian dataset
+ xs, ys = ot.datasets.get_data_classif('gaussrot', n_samples)
- nbnoise = 8
+ n_features_noise = 8
- xs = np.hstack((xs, np.random.randn(n, nbnoise)))
+ xs = np.hstack((xs, np.random.randn(n_samples, n_features_noise)))
p = 2