Exemplo n.º 1
0
def test_marginalize():
    outcomes = ['000', '011', '101', '110']
    pmf = [1 / 4] * 4
    d = Distribution(outcomes, pmf)
    d1 = d.marginal([0, 2])
    d2 = d.marginalize([1])
    assert d1.is_approx_equal(d2)
Exemplo n.º 2
0
def test_marginalize():
    outcomes = ['000', '011', '101', '110']
    pmf = [1/4]*4
    d = Distribution(outcomes, pmf)
    d1 = d.marginal([0, 2])
    d2 = d.marginalize([1])
    assert_true(d1.is_approx_equal(d2))
Exemplo n.º 3
0
def test_outcome_length():
    outcomes = ['000', '011', '101', '110']
    pmf = [1 / 4] * 4
    d = Distribution(outcomes, pmf)
    d = d.marginal([0, 2])
    assert d.outcome_length() == 2
    assert d.outcome_length(masked=True) == 3
Exemplo n.º 4
0
def test_outcome_length():
    outcomes = ['000', '011', '101', '110']
    pmf = [1/4]*4
    d = Distribution(outcomes, pmf)
    d = d.marginal([0, 2])
    assert_equal(d.outcome_length(), 2)
    assert_equal(d.outcome_length(masked=True), 3)