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

Method test_predict

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

Source from the content-addressed store, hash-verified

1532class TestCommitteeRegressor(unittest.TestCase):
1533
1534 def test_predict(self):
1535 for n_members in range(1, 10):
1536 for n_instances in range(1, 100):
1537 vote = np.random.rand(n_instances, n_members)
1538 # assembling the Committee
1539 learner_list = [mock.MockActiveLearner(predict_return=vote[:, member_idx])
1540 for member_idx in range(n_members)]
1541 committee = modAL.models.learners.CommitteeRegressor(
1542 learner_list=learner_list)
1543 np.testing.assert_array_almost_equal(
1544 committee.predict(np.random.rand(
1545 n_instances).reshape(-1, 1), return_std=False),
1546 np.mean(vote, axis=1)
1547 )
1548 np.testing.assert_array_almost_equal(
1549 committee.predict(np.random.rand(
1550 n_instances).reshape(-1, 1), return_std=True),
1551 (np.mean(vote, axis=1), np.std(vote, axis=1))
1552 )
1553
1554 def test_vote(self):
1555 for n_members in range(1, 10):

Callers

nothing calls this directly

Calls 1

predictMethod · 0.95

Tested by

no test coverage detected