MCPcopy Create free account
hub / github.com/modAL-python/modAL / test_weighted_random

Method test_weighted_random

tests/core_tests.py:231–241  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

229 )
230
231 def test_weighted_random(self):
232 for n_pool in range(2, 100):
233 for n_instances in range(1, n_pool):
234 utility = np.ones(n_pool)
235 query_idx = modAL.utils.selection.weighted_random(
236 utility, n_instances)
237 # testing for correct number of returned indices
238 np.testing.assert_equal(len(query_idx), n_instances)
239 # testing for uniqueness of each query index
240 np.testing.assert_equal(
241 len(query_idx), len(np.unique(query_idx)))
242
243
244class TestAcquisitionFunctions(unittest.TestCase):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected