예제 #1
0
def test_validate_tpm_conditional_independence():
    tpm = np.array([
        [1, 0, 0, 0],
        [0, .5, .5, 0],
        [0, .5, .5, 0],
        [0, 0, 0, 1],
    ])
    with pytest.raises(ValueError):
        validate.tpm(tpm)
예제 #2
0
def test_validate_tpm_conditional_independence():
    tpm = np.array([
        [1,  0,  0,  0],
        [0, .5, .5,  0],
        [0, .5, .5,  0],
        [0,  0,  0,  1],
    ])
    with pytest.raises(ValueError):
        validate.tpm(tpm)
예제 #3
0
def test_validate_tpm_conditional_independence():
    tpm = np.array([
        [1, 0.0, 0.0, 0],
        [0, 0.5, 0.5, 0],
        [0, 0.5, 0.5, 0],
        [0, 0.0, 0.0, 1],
    ])
    with pytest.raises(exceptions.ConditionallyDependentError):
        validate.conditionally_independent(tpm)
    with pytest.raises(exceptions.ConditionallyDependentError):
        validate.tpm(tpm)
    validate.tpm(tpm, check_independence=False)
예제 #4
0
def test_validate_tpm_conditional_independence():
    tpm = np.array([
        [1, 0.0, 0.0, 0],
        [0, 0.5, 0.5, 0],
        [0, 0.5, 0.5, 0],
        [0, 0.0, 0.0, 1],
    ])
    with pytest.raises(ValueError):
        validate.conditionally_independent(tpm)
    with config.override(VALIDATE_CONDITIONAL_INDEPENDENCE=False):
        validate.conditionally_independent(tpm)
    with pytest.raises(ValueError):
        validate.tpm(tpm)
    validate.tpm(tpm, check_independence=False)
예제 #5
0
def test_validate_tpm_conditional_independence():
    tpm = np.array([
        [1, 0.0, 0.0, 0],
        [0, 0.5, 0.5, 0],
        [0, 0.5, 0.5, 0],
        [0, 0.0, 0.0, 1],
    ])
    with pytest.raises(ValueError):
        validate.conditionally_independent(tpm)
    with config.override(VALIDATE_CONDITIONAL_INDEPENDENCE=False):
        validate.conditionally_independent(tpm)
    with pytest.raises(ValueError):
        validate.tpm(tpm)
    validate.tpm(tpm, check_independence=False)
예제 #6
0
def test_validate_tpm_nonbinary_nodes():
    tpm = np.arange(3 * 3 * 2).reshape(3, 3, 2)
    with pytest.raises(ValueError):
        assert validate.tpm(tpm)
예제 #7
0
def test_validate_tpm_wrong_shape():
    tpm = np.arange(3**3).reshape(3, 3, 3)
    with pytest.raises(ValueError):
        assert validate.tpm(tpm)
예제 #8
0
def test_validate_tpm_nonbinary_nodes():
    tpm = np.arange(3*3*2).reshape(3, 3, 2)
    with pytest.raises(ValueError):
        assert validate.tpm(tpm)
예제 #9
0
def test_validate_tpm_wrong_shape():
    tpm = np.arange(3**3).reshape(3, 3, 3)
    with pytest.raises(ValueError):
        assert validate.tpm(tpm)