|
10 | 10 | Cauchy,
|
11 | 11 | ChiSquared,
|
12 | 12 | Constant,
|
| 13 | + DiscreteUniform, |
13 | 14 | Exponential,
|
14 | 15 | Flat,
|
15 | 16 | Gamma,
|
|
18 | 19 | HalfFlat,
|
19 | 20 | HalfNormal,
|
20 | 21 | HalfStudentT,
|
| 22 | + HyperGeometric, |
21 | 23 | Kumaraswamy,
|
22 | 24 | Laplace,
|
23 | 25 | Logistic,
|
@@ -417,7 +419,12 @@ def test_poisson_moment(mu, size, expected):
|
417 | 419 | (10, 0.7, None, 4),
|
418 | 420 | (10, 0.7, 5, np.full(5, 4)),
|
419 | 421 | (np.full(3, 10), np.arange(1, 4) / 10, None, np.array([90, 40, 23])),
|
420 |
| - (10, np.arange(1, 4) / 10, (2, 3), np.full((2, 3), np.array([90, 40, 23]))), |
| 422 | + ( |
| 423 | + 10, |
| 424 | + np.arange(1, 4) / 10, |
| 425 | + (2, 3), |
| 426 | + np.full((2, 3), np.array([90, 40, 23])), |
| 427 | + ), |
421 | 428 | ],
|
422 | 429 | )
|
423 | 430 | def test_negative_binomial_moment(n, p, size, expected):
|
@@ -461,7 +468,13 @@ def test_zero_inflated_poisson_moment(psi, theta, size, expected):
|
461 | 468 | (0.2, 7, 0.7, None, 4),
|
462 | 469 | (0.2, 7, 0.3, 5, np.full(5, 2)),
|
463 | 470 | (0.6, 25, np.arange(1, 6) / 10, None, np.arange(1, 6)),
|
464 |
| - (0.6, 25, np.arange(1, 6) / 10, (2, 5), np.full((2, 5), np.arange(1, 6))), |
| 471 | + ( |
| 472 | + 0.6, |
| 473 | + 25, |
| 474 | + np.arange(1, 6) / 10, |
| 475 | + (2, 5), |
| 476 | + np.full((2, 5), np.arange(1, 6)), |
| 477 | + ), |
465 | 478 | ],
|
466 | 479 | )
|
467 | 480 | def test_zero_inflated_binomial_moment(psi, n, p, size, expected):
|
@@ -503,3 +516,44 @@ def test_geometric_moment(p, size, expected):
|
503 | 516 | with Model() as model:
|
504 | 517 | Geometric("x", p=p, size=size)
|
505 | 518 | assert_moment_is_expected(model, expected)
|
| 519 | + |
| 520 | + |
| 521 | +@pytest.mark.parametrize( |
| 522 | + "N, k, n, size, expected", |
| 523 | + [ |
| 524 | + (50, 10, 20, None, 4), |
| 525 | + (50, 10, 23, 5, np.full(5, 5)), |
| 526 | + (50, 10, np.arange(23, 28), None, np.full(5, 5)), |
| 527 | + ( |
| 528 | + 50, |
| 529 | + 10, |
| 530 | + np.arange(18, 23), |
| 531 | + (2, 5), |
| 532 | + np.full((2, 5), 4), |
| 533 | + ), |
| 534 | + ], |
| 535 | +) |
| 536 | +def test_hyper_geometric_moment(N, k, n, size, expected): |
| 537 | + with Model() as model: |
| 538 | + HyperGeometric("x", N=N, k=k, n=n, size=size) |
| 539 | + assert_moment_is_expected(model, expected) |
| 540 | + |
| 541 | + |
| 542 | +@pytest.mark.parametrize( |
| 543 | + "lower, upper, size, expected", |
| 544 | + [ |
| 545 | + (1, 5, None, 3), |
| 546 | + (1, 5, 5, np.full(5, 3)), |
| 547 | + (1, np.arange(5, 22, 4), None, np.arange(3, 13, 2)), |
| 548 | + ( |
| 549 | + 1, |
| 550 | + np.arange(5, 22, 4), |
| 551 | + (2, 5), |
| 552 | + np.full((2, 5), np.arange(3, 13, 2)), |
| 553 | + ), |
| 554 | + ], |
| 555 | +) |
| 556 | +def test_discrete_uniform_moment(lower, upper, size, expected): |
| 557 | + with Model() as model: |
| 558 | + DiscreteUniform("x", lower=lower, upper=upper, size=size) |
| 559 | + assert_moment_is_expected(model, expected) |
0 commit comments