|
39 | 39 | Logistic,
|
40 | 40 | LogitNormal,
|
41 | 41 | LogNormal,
|
| 42 | + MatrixNormal, |
42 | 43 | Moyal,
|
| 44 | + MvStudentT, |
43 | 45 | NegativeBinomial,
|
44 | 46 | Normal,
|
45 | 47 | Pareto,
|
@@ -830,6 +832,33 @@ def test_moyal_moment(mu, sigma, size, expected):
|
830 | 832 | assert_moment_is_expected(model, expected)
|
831 | 833 |
|
832 | 834 |
|
| 835 | +rand1d = np.random.rand(2) |
| 836 | +rand2d = np.random.rand(2, 3) |
| 837 | + |
| 838 | + |
| 839 | +@pytest.mark.parametrize( |
| 840 | + "nu, mu, cov, size, expected", |
| 841 | + [ |
| 842 | + (2, np.ones(1), np.eye(1), None, np.ones(1)), |
| 843 | + (2, rand1d, np.eye(2), None, rand1d), |
| 844 | + (2, rand1d, np.eye(2), 2, np.full((2, 2), rand1d)), |
| 845 | + (2, rand1d, np.eye(2), (2, 5), np.full((2, 5, 2), rand1d)), |
| 846 | + (2, rand2d, np.eye(3), None, rand2d), |
| 847 | + (2, rand2d, np.eye(3), 2, np.full((2, 2, 3), rand2d)), |
| 848 | + (2, rand2d, np.eye(3), (2, 5), np.full((2, 5, 2, 3), rand2d)), |
| 849 | + ], |
| 850 | +) |
| 851 | +def test_mvstudentt_moment(nu, mu, cov, size, expected): |
| 852 | + with Model() as model: |
| 853 | + MvStudentT("x", nu=nu, mu=mu, cov=cov, size=size) |
| 854 | + assert_moment_is_expected(model, expected) |
| 855 | + |
| 856 | + |
| 857 | +def check_matrixnormal_moment(mu, rowchol, colchol, size, expected): |
| 858 | + with Model() as model: |
| 859 | + MatrixNormal("x", mu=mu, rowchol=rowchol, colchol=colchol, size=size) |
| 860 | + |
| 861 | + |
833 | 862 | @pytest.mark.parametrize(
|
834 | 863 | "alpha, mu, sigma, size, expected",
|
835 | 864 | [
|
@@ -886,6 +915,24 @@ def test_asymmetriclaplace_moment(b, kappa, mu, size, expected):
|
886 | 915 | assert_moment_is_expected(model, expected)
|
887 | 916 |
|
888 | 917 |
|
| 918 | +@pytest.mark.parametrize( |
| 919 | + "mu, rowchol, colchol, size, expected", |
| 920 | + [ |
| 921 | + (np.ones((1, 1)), np.eye(1), np.eye(1), None, np.ones((1, 1))), |
| 922 | + (np.ones((1, 1)), np.eye(2), np.eye(3), None, np.ones((2, 3))), |
| 923 | + (rand2d, np.eye(2), np.eye(3), None, rand2d), |
| 924 | + (rand2d, np.eye(2), np.eye(3), 2, np.full((2, 2, 3), rand2d)), |
| 925 | + (rand2d, np.eye(2), np.eye(3), (2, 5), np.full((2, 5, 2, 3), rand2d)), |
| 926 | + ], |
| 927 | +) |
| 928 | +def test_matrixnormal_moment(mu, rowchol, colchol, size, expected): |
| 929 | + if size is None: |
| 930 | + check_matrixnormal_moment(mu, rowchol, colchol, size, expected) |
| 931 | + else: |
| 932 | + with pytest.raises(NotImplementedError): |
| 933 | + check_matrixnormal_moment(mu, rowchol, colchol, size, expected) |
| 934 | + |
| 935 | + |
889 | 936 | @pytest.mark.parametrize(
|
890 | 937 | "nu, sigma, size, expected",
|
891 | 938 | [
|
|
0 commit comments