| 41 | |
| 42 | @pytest.mark.skipif(nogo, reason="Missing modules (autograd or pymanopt)") |
| 43 | def test_wda(): |
| 44 | n_samples = 100 # nb samples in source and target datasets |
| 45 | rng = np.random.RandomState(0) |
| 46 | |
| 47 | # generate gaussian dataset |
| 48 | xs, ys = ot.datasets.make_data_classif("gaussrot", n_samples, random_state=rng) |
| 49 | |
| 50 | n_features_noise = 8 |
| 51 | |
| 52 | xs = np.hstack((xs, rng.randn(n_samples, n_features_noise))) |
| 53 | |
| 54 | p = 2 |
| 55 | |
| 56 | Pwda, projwda = ot.dr.wda(xs, ys, p, maxiter=10) |
| 57 | |
| 58 | projwda(xs) |
| 59 | |
| 60 | np.testing.assert_allclose(np.sum(Pwda**2, 0), np.ones(p)) |
| 61 | |
| 62 | |
| 63 | @pytest.mark.skipif(nogo, reason="Missing modules (autograd or pymanopt)") |