| 20 | |
| 21 | @pytest.mark.skipif(nogo, reason="Missing modules (autograd or pymanopt)") |
| 22 | def test_fda(): |
| 23 | n_samples = 90 # nb samples in source and target datasets |
| 24 | rng = np.random.RandomState(0) |
| 25 | |
| 26 | # generate gaussian dataset |
| 27 | xs, ys = ot.datasets.make_data_classif("gaussrot", n_samples, random_state=rng) |
| 28 | |
| 29 | n_features_noise = 8 |
| 30 | |
| 31 | xs = np.hstack((xs, rng.randn(n_samples, n_features_noise))) |
| 32 | |
| 33 | p = 1 |
| 34 | |
| 35 | Pfda, projfda = ot.dr.fda(xs, ys, p) |
| 36 | |
| 37 | projfda(xs) |
| 38 | |
| 39 | np.testing.assert_allclose(np.sum(Pfda**2, 0), np.ones(p)) |
| 40 | |
| 41 | |
| 42 | @pytest.mark.skipif(nogo, reason="Missing modules (autograd or pymanopt)") |