Exemple #1
0
def test_validate_rejects_exclude_constraints():
    block = fully_cross_block([color, text, con_factor_within_trial],
                              [color, text], [Exclude(color, red_color)])

    with pytest.raises(ValueError):
        UniformCombinatoricSamplingStrategy._UniformCombinatoricSamplingStrategy__validate(
            block)
Exemple #2
0
def test_validate_accepts_derived_factors_with_simple_windows():
    block = fully_cross_block([color, text, con_factor_within_trial],
                              [color, text], [])
    UniformCombinatoricSamplingStrategy._UniformCombinatoricSamplingStrategy__validate(
        block)

    block = fully_cross_block([color, text, con_factor_window], [color, text],
                              [])
    UniformCombinatoricSamplingStrategy._UniformCombinatoricSamplingStrategy__validate(
        block)
Exemple #3
0
def test_validate_rejects_derived_factors_with_complex_windows():
    block = fully_cross_block([color, text, color_repeats_factor],
                              [color, text], [])
    with pytest.raises(ValueError):
        UniformCombinatoricSamplingStrategy._UniformCombinatoricSamplingStrategy__validate(
            block)
Exemple #4
0
def test_validate_accepts_basic_factors():
    block = fully_cross_block([color, text], [color, text], [])
    UniformCombinatoricSamplingStrategy._UniformCombinatoricSamplingStrategy__validate(
        block)
Exemple #5
0
def sample():
    sampling_result = UniformCombinatoricSamplingStrategy.sample(
        blocks['stroop-20'], 10000)
    from pprint import pprint
    pprint(sampling_result.metrics['avg_rejected'])