feat(sobol): the number of classes with draws, for the expectation without an effect
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
parent
9f25aad7de
commit
925df404a0
2 changed files with 20 additions and 5 deletions
|
|
@ -251,4 +251,9 @@ def test_forventningen_uten_virkning_er_om_lag_M_minus_1_over_N_minus_1() -> Non
|
|||
indekser = [sobol.indeks(rng.normal(size=N).tolist(), y) for _ in range(300)]
|
||||
snitt = math.fsum(i for i in indekser if i is not None) / 300
|
||||
assert sobol.forventning_uten_virkning(N) == 9 / 399
|
||||
# a quantity with few values has fewer classes with draws, and a lower expectation
|
||||
x = [0.0] * 100 + [1.0] * 100 + [2.0] * 200
|
||||
assert sobol.klasser_med_trekninger(x) == 3
|
||||
assert sobol.klasser_med_trekninger(rng.normal(size=N).tolist()) == 10
|
||||
assert sobol.forventning_uten_virkning(N, 3) == 2 / 399
|
||||
assert snitt == pytest.approx(9 / 399, abs=0.002)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue