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

Method test_query

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

Source from the content-addressed store, hash-verified

1017 )
1018
1019 def test_query(self):
1020 for n_samples in range(1, 100):
1021 for n_features in range(1, 10):
1022 X = np.random.rand(n_samples, n_features)
1023 query_idx = np.random.randint(0, n_samples)
1024 query_metrics = np.random.randint(0, n_samples)
1025 mock_query = mock.MockFunction(
1026 return_val=(query_idx, query_metrics))
1027 learner = modAL.models.learners.ActiveLearner(
1028 estimator=None,
1029 query_strategy=mock_query
1030 )
1031 np.testing.assert_equal(
1032 learner.query(X),
1033 (query_idx, X[query_idx])
1034 )
1035 np.testing.assert_equal(
1036 learner.query(X, return_metrics=True),
1037 (query_idx, X[query_idx], query_metrics)
1038 )
1039
1040 def test_score(self):
1041 test_cases = (np.random.rand() for _ in range(10))

Callers

nothing calls this directly

Calls 1

queryMethod · 0.45

Tested by

no test coverage detected