moe.tests.bandit.epsilon package

Submodules

moe.tests.bandit.epsilon.epsilon_first_test module

Test epsilon-first bandit implementation.

Test default values with one, two, and three arms. Test one arm with various epsilon values.

class moe.tests.bandit.epsilon.epsilon_first_test.TestEpsilonFirst[source]

Bases: moe.tests.bandit.epsilon.epsilon_test_case.EpsilonTestCase

Verify that different epsilon values and historical infos return correct results.

bandit_class

alias of EpsilonFirst

test_init_default()[source]

Verify that default values do not throw and error. This is purely an integration test.

test_one_arm()[source]

Check that the one-arm case always returns the given arm as the winning arm and the allocation is 1.0.

test_three_arms_exploit()[source]

Check that the three-arms cases with integer and float payoffs in exploitation phase return the expected arm allocations.

test_three_arms_exploit_two_winners()[source]

Check that the three-arms cases with two winners in exploitation phase return the expected arm allocations. This tests num_arms > num_winning_arms > 1.

test_three_arms_explore()[source]

Check that the three-arms cases with integer and float payoffs in exploration phase return the expected arm allocations.

test_two_arms_epsilon_one()[source]

Check that the two-arms case with one epsilon (always explore) always allocate arm1:0.5 and arm2:0.5 when average payoffs are arm1:1.0 and arm2:0.0.

test_two_arms_epsilon_zero()[source]

Check that the two-arms case with zero epsilon (always exploit) always allocate arm1:1.0 and arm2:0.0 when average payoffs are arm1:1.0 and arm2:0.0.

test_two_unsampled_arms()[source]

Check that the two-unsampled-arms case always allocate each arm equally (the allocation is 0.5 for both arms). This tests num_winning_arms == num_arms > 1.

total_samples_to_test = [1, 10, 100]

moe.tests.bandit.epsilon.epsilon_greedy_test module

Test epsilon-greedy bandit implementation.

Test default values with one, two, and three arms. Test one arm with various epsilon values.

class moe.tests.bandit.epsilon.epsilon_greedy_test.TestEpsilonGreedy[source]

Bases: moe.tests.bandit.epsilon.epsilon_test_case.EpsilonTestCase

Verify that different epsilon values and historical infos return correct results.

bandit_class

alias of EpsilonGreedy

test_init_default()[source]

Verify that default values do not throw and error. This is purely an integration test.

test_one_arm()[source]

Check that the one-arm case always returns the given arm as the winning arm and the allocation is 1.0.

test_three_arms()[source]

Check that the three-arms cases with integer and float payoffs return the expected arm allocations.

test_three_arms_two_winners()[source]

Check that the three-arms cases with two winners return the expected arm allocations. This tests num_arms > num_winning_arms > 1.

test_two_arms_epsilon_one()[source]

Check that the two-arms case with one epsilon always allocate arm1:0.5 and arm2:0.5 when average payoffs are arm1:1.0 and arm2:0.0.

test_two_arms_epsilon_zero()[source]

Check that the two-arms case with zero epsilon always allocate arm1:1.0 and arm2:0.0 when average payoffs are arm1:1.0 and arm2:0.0.

test_two_unsampled_arms()[source]

Check that the two-unsampled-arms case always allocate each arm equally (the allocation is 0.5 for both arms). This tests num_winning_arms == num_arms > 1.

moe.tests.bandit.epsilon.epsilon_test module

Test epsilon bandit implementation (functions common to epsilon bandit).

Test functions in moe.bandit.epsilon.epsilon_interface.EpsilonInterface

class moe.tests.bandit.epsilon.epsilon_test.TestEpsilon[source]

Bases: moe.tests.bandit.epsilon.epsilon_test_case.EpsilonTestCase

Verify that different sample_arms return correct results.

test_empty_arm_invalid()[source]

Test empty sample_arms causes an ValueError.

test_three_arms_two_winners()[source]

Check that the three-arms cases with two winners return the expected winning arms. This tests num_arms > num_winning_arms > 1.

test_two_unsampled_arms()[source]

Check that the two-unsampled-arms case always returns both arms as winning arms. This tests num_winning_arms == num_arms > 1.

moe.tests.bandit.epsilon.epsilon_test.disable_logging(request)[source]

Disable logging (for the duration of this test case).

moe.tests.bandit.epsilon.epsilon_test_case module

Base test case class for bandit epsilon tests; includes different epsilon values to test.

class moe.tests.bandit.epsilon.epsilon_test_case.EpsilonTestCase[source]

Bases: moe.tests.bandit.bandit_test_case.BanditTestCase

Base test case for the bandit library.

Test different epsilon values.

epsilons_to_test = [0.05, 0.0, 0.5, 1.0]

Module contents

Testing code for the (Python) epsilon bandit policies.

Files in this package * moe.tests.bandit.epsilon.epsilon_first_test: tests for moe.bandit.epsilon.epsilon_greedy.EpsilonFirst * moe.tests.bandit.epsilon.epsilon_greedy_test: tests for moe.bandit.epsilon.epsilon_greedy.EpsilonGreedy * moe.tests.bandit.epsilon.epsilon_test: tests for moe.bandit.epsilon.epsilon_greedy.Epsilon * moe.tests.bandit.epsilon.epsilon_test_case: test cases for classes under moe.bandit.epsilon.epsilon.Epsilon