コード例 #1
0
ファイル: test_npscalardist.py プロジェクト: gto00002/dit
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)
コード例 #2
0
ファイル: test_npscalardist.py プロジェクト: psychon7/dit
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)
コード例 #3
0
ファイル: test_npscalardist.py プロジェクト: gto00002/dit
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)
コード例 #4
0
ファイル: test_npscalardist.py プロジェクト: psychon7/dit
def test_del2():
    d = ScalarDistribution([1 / 2, 1 / 2])
    d.make_dense()
    del d[1]
    d.normalize()
    assert d[0] == pytest.approx(1)
コード例 #5
0
ファイル: test_npscalardist.py プロジェクト: gto00002/dit
def test_del2():
    d = ScalarDistribution([1 / 2, 1 / 2])
    d.make_dense()
    del d[1]
    d.normalize()
    assert_almost_equal(d[0], 1)
コード例 #6
0
ファイル: test_npscalardist.py プロジェクト: gto00002/dit
def test_del2():
    d = ScalarDistribution([1 / 2, 1 / 2])
    d.make_dense()
    del d[1]
    d.normalize()
    assert_almost_equal(d[0], 1)
コード例 #7
0
ファイル: test_npscalardist.py プロジェクト: skinnersrat/dit
def test_del1():
    d = ScalarDistribution([1 / 2] * 2)
    del d[1]
    d.normalize()
    assert d[0] == pytest.approx(1)