(nx, method_params)
| 669 | |
| 670 | @pytest.mark.parametrize("method_params", lst_method_params_solve_sample) |
| 671 | def test_solve_sample_methods(nx, method_params): |
| 672 | n_samples_s = 10 |
| 673 | n_samples_t = 9 |
| 674 | n_features = 2 |
| 675 | rng = np.random.RandomState(42) |
| 676 | |
| 677 | x = rng.randn(n_samples_s, n_features) |
| 678 | y = rng.randn(n_samples_t, n_features) |
| 679 | a = ot.utils.unif(n_samples_s) |
| 680 | b = ot.utils.unif(n_samples_t) |
| 681 | |
| 682 | xb, yb, ab, bb = nx.from_numpy(x, y, a, b) |
| 683 | |
| 684 | sol = ot.solve_sample(x, y, **method_params) |
| 685 | solb = ot.solve_sample(xb, yb, ab, bb, **method_params) |
| 686 | |
| 687 | # check some attributes (no need ) |
| 688 | assert_allclose_sol(sol, solb) |
| 689 | |
| 690 | sol2 = ot.solve_sample(x, x, **method_params) |
| 691 | if method_params["method"] not in ["factored", "lowrank", "nystroem"]: |
| 692 | np.testing.assert_allclose(sol2.value, 0, atol=1e-10) |
| 693 | |
| 694 | |
| 695 | @pytest.mark.parametrize("method_params", lst_parameters_solve_sample_NotImplemented) |
nothing calls this directly
no test coverage detected