Beispiel #1
0
def test_setitem3():
    outcomes = (0, 1)
    pmf = [1 / 2, 1 / 2]
    d = ScalarDistribution(outcomes, pmf, sample_space=(0, 1, 2))
    d[2] = 1 / 2
    d.normalize()
    assert_array_almost_equal(d.pmf, [1 / 3] * 3)
Beispiel #2
0
def test_setitem3():
    outcomes = (0, 1)
    pmf = [1 / 2, 1 / 2]
    d = ScalarDistribution(outcomes, pmf, sample_space=(0, 1, 2))
    d[2] = 1 / 2
    d.normalize()
    assert np.allclose(d.pmf, [1 / 3] * 3)
Beispiel #3
0
def test_setitem3():
    outcomes = (0, 1)
    pmf = [1 / 2, 1 / 2]
    d = ScalarDistribution(outcomes, pmf, sample_space=(0, 1, 2))
    d[2] = 1 / 2
    d.normalize()
    assert_array_almost_equal(d.pmf, [1 / 3] * 3)
Beispiel #4
0
def test_del2():
    d = ScalarDistribution([1 / 2, 1 / 2])
    d.make_dense()
    del d[1]
    d.normalize()
    assert d[0] == pytest.approx(1)
Beispiel #5
0
def test_del2():
    d = ScalarDistribution([1 / 2, 1 / 2])
    d.make_dense()
    del d[1]
    d.normalize()
    assert_almost_equal(d[0], 1)
Beispiel #6
0
def test_del2():
    d = ScalarDistribution([1 / 2, 1 / 2])
    d.make_dense()
    del d[1]
    d.normalize()
    assert_almost_equal(d[0], 1)
Beispiel #7
0
def test_del1():
    d = ScalarDistribution([1 / 2] * 2)
    del d[1]
    d.normalize()
    assert d[0] == pytest.approx(1)