probcomp/crosscat

test_multiple_col_ensure.py is stochastic

Open

#100 opened on May 5, 2016

View on GitHub
 (0 comments) (0 reactions) (0 assignees)Python (41 forks)batch import
help wantedk min/hr

Repository metrics

Stars
 (321 stars)
PR merge metrics
 (No merged PRs in 30d)

Description

This failure should not be stochastic because we fixed the seed. But sometimes it fails like this:

=================================== FAILURES ===================================
_________________ test_multiple_col_ensure[130223-False-True] __________________

seed = 130223, dependent = False, analyze = True

@pytest.mark.parametrize("seed, dependent, analyze", single_args)
def test_multiple_col_ensure(seed, dependent, analyze):
    rng = random.Random(seed)
    T, M_r, M_c, X_L, X_D, engine = quick_le(get_next_seed(rng))
    col_pairs = [(c1, c2,) for c1, c2 in it.combinations(range(N_COLS), 2)]
    ensure_pairs = random.sample(col_pairs, 4)
    dep_constraints = [(c1, c2, dependent) for c1, c2 in ensure_pairs]

    X_L, X_D = engine.ensure_col_dep_constraints(M_c, M_r, T, X_L, X_D,
    dep_constraints, get_next_seed(rng))

    for col1, col2, dep in dep_constraints:
    assert engine.assert_col_dep_constraints(X_L, X_D, col1, col2, dep, True)

    if analyze:
    X_L, X_D = engine.analyze(M_c, T, X_L, X_D, get_next_seed(rng),
        n_steps=1000)

    for col1, col2, dep in dep_constraints:
>               assert engine.assert_col_dep_constraints(X_L, X_D, col1, col2, dep, True)
E               assert <bound method LocalEngine.assert_col_dep_constraints of <crosscat.LocalEngine.LocalEngine object at 0x7fc498d4f210>>({'col_ensure': {'dependent': {}, 'independent': {'1': [9], '2': [5], '3': [6], '5': [2], ...}}, 'column_hypers': [{'fi... 'column_names': [5, 6, 7, 8, 9], 'row_partition_model': {'counts': [5, 5], 'hypers': {'alpha': 0.2511886431509581}}}]}, [[0, 1, 1, 0, 0, 0, ...], [0, 1, 1, 1, 1, 0, ...]], 6, 9, False, True)
E                +  where <bound method LocalEngine.assert_col_dep_constraints of <crosscat.LocalEngine.LocalEngine object at 0x7fc498d4f210>> = <crosscat.LocalEngine.LocalEngine object at 0x7fc498d4f210>.assert_col_dep_constraints

src/tests/unit_tests/test_col_ensure.py:123: AssertionError
===Flaky Test Report===

Contributor guide