moe.tests.bandit package¶
Subpackages¶
Submodules¶
moe.tests.bandit.bandit_interface_test module¶
Test bandit interface implementation.
- class moe.tests.bandit.bandit_interface_test.TestBanditInterface[source]¶
Bases: moe.tests.bandit.bandit_test_case.BanditTestCase
Verify that different historical infos return correct results.
- test_one_arm()[source]¶
Check that the one-arm case always returns the given arm as the winning arm.
moe.tests.bandit.bandit_test_case module¶
Base test case class for bandit tests; includes different historical infos (different sampled arms).
- class moe.tests.bandit.bandit_test_case.BanditTestCase[source]¶
Bases: object
Base test case for the bandit library.
This sets up arms for test cases and includes an integration test case for verifying that default values do not throw an error.
- bandit_class = None¶
Set up arms for test cases.
- bernoulli_historical_infos_to_test = [<moe.bandit.data_containers.HistoricalData object at 0x11a880980>, <moe.bandit.data_containers.HistoricalData object at 0x11a8809b8>, <moe.bandit.data_containers.HistoricalData object at 0x11a8809f0>]¶
- historical_infos_to_test = [<moe.bandit.data_containers.HistoricalData object at 0x11a880a28>, <moe.bandit.data_containers.HistoricalData object at 0x11a880a60>, <moe.bandit.data_containers.HistoricalData object at 0x11a880a98>, <moe.bandit.data_containers.HistoricalData object at 0x11a880ad0>, <moe.bandit.data_containers.HistoricalData object at 0x11a880b08>, <moe.bandit.data_containers.HistoricalData object at 0x11a880980>, <moe.bandit.data_containers.HistoricalData object at 0x11a8809b8>, <moe.bandit.data_containers.HistoricalData object at 0x11a8809f0>]¶
- one_arm_test_case = <moe.bandit.data_containers.HistoricalData object at 0x11a880980>¶
- three_arms_float_payoffs_test_case = <moe.bandit.data_containers.HistoricalData object at 0x11a880a60>¶
- three_arms_test_case = <moe.bandit.data_containers.HistoricalData object at 0x11a880a28>¶
- three_arms_two_winners_no_unsampled_arm_test_case = <moe.bandit.data_containers.HistoricalData object at 0x11a880ad0>¶
- three_arms_two_winners_test_case = <moe.bandit.data_containers.HistoricalData object at 0x11a880a98>¶
- three_arms_with_variance_no_unsampled_arm_test_case = <moe.bandit.data_containers.HistoricalData object at 0x11a880b08>¶
- two_arms_test_case = <moe.bandit.data_containers.HistoricalData object at 0x11a8809f0>¶
- two_unsampled_arms_test_case = <moe.bandit.data_containers.HistoricalData object at 0x11a8809b8>¶
moe.tests.bandit.data_containers_test module¶
Tests for functions in SampleArm and HistoricalData.
- class moe.tests.bandit.data_containers_test.TestDataContainers[source]¶
Bases: moe.tests.bandit.bandit_test_case.BanditTestCase
Tests functions in moe.bandit.data_containers.SampleArm and moe.bandit.data_containers.HistoricalData.
- test_historical_data_append_arms()[source]¶
Test that appending arms to HistoricalData updates historical info correctly.
- test_historical_data_append_arms_with_variance_invalid()[source]¶
Test that adding arms with variance causes a ValueError.
- test_historical_data_append_unsampled_arm()[source]¶
Test that adding an unsampled arm (already exists in historical info) to HistoricalData does not change anything.
- test_sample_arm_add_arm_with_variance_invalid()[source]¶
Test that adding arms with variance causes a ValueError. Neither of the arms can have non-None variance.
moe.tests.bandit.linkers_test module¶
Tests that linkers contain all possible types defined in constants.
- class moe.tests.bandit.linkers_test.TestLinkers[source]¶
Bases: object
Tests that linkers contain all possible types defined in constants.
- test_bandit_links_have_all_bandit_endpoints()[source]¶
Test each bandit endpoint is in a linker, and every linker key is a bandit endpoint.
moe.tests.bandit.utils_test module¶
Tests for functions in utils.
- class moe.tests.bandit.utils_test.TestUtils[source]¶
Bases: moe.tests.bandit.bandit_test_case.BanditTestCase
Tests moe.bandit.utils.get_winning_arm_names_from_payoff_arm_name_list() and moe.bandit.utils.get_equal_arm_allocations().
- test_get_equal_arm_allocations_empty_arm_invalid()[source]¶
Test empty arms_sampled causes an ValueError.
- test_get_equal_arm_allocations_no_winner()[source]¶
Test allocations split among all sample arms when there is no winner.
- test_get_equal_arm_allocations_two_winners()[source]¶
Test allocations split between two winning arms.
- test_get_winning_arm_names_from_payoff_arm_name_list_empty_list_invalid()[source]¶
Test empty payoff_arm_name_list causes an ValueError.
Module contents¶
Testing code for the (Python) bandit library.
Testing is done via the Testify package: https://github.com/Yelp/Testify
This package includes:
- Test cases/test setup files
- Tests for bandit/epsilon: moe.tests.bandit.epsilon
- Tests for bandit/ucb: moe.tests.bandit.ucb
- Tests for bandit/bla: moe.tests.bandit.bla
This package includes:
- Test cases/test setup files
- Tests for classes and utils in moe.bandit
Files in this package
- moe.tests.bandit.bandit_interface_test: tests for moe.bandit.interfaces.bandit_interface.BanditInterface
- moe.tests.bandit.bandit_test_case: base test case for bandit tests with a simple integration test case
- moe.tests.bandit.linkers_test: tests for moe.bandit.linkers
- moe.tests.bandit.utils_test: tests for moe.bandit.utils