(nx)
| 50 | |
| 51 | |
| 52 | def test_gaussian_pdf(nx): |
| 53 | rng = np.random.RandomState(seed=42) |
| 54 | n = 7 |
| 55 | d = 3 |
| 56 | x = nx.from_numpy(rng.randn(n, d)) |
| 57 | m, _, C, _, _, _ = get_gmms(nx) |
| 58 | pdf = gaussian_pdf(x, m[0], C[0]) |
| 59 | assert pdf.shape == (n,) |
| 60 | |
| 61 | x = nx.from_numpy(rng.randn(n, n, d)) |
| 62 | pdf = gaussian_pdf(x, m[0], C[0]) |
| 63 | assert pdf.shape == ( |
| 64 | n, |
| 65 | n, |
| 66 | ) |
| 67 | |
| 68 | with pytest.raises(AssertionError): |
| 69 | gaussian_pdf(x, m[0, :-1], C[0]) |
| 70 | |
| 71 | |
| 72 | def test_gmm_pdf(nx): |
nothing calls this directly
no test coverage detected