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

Method test_make_query_strategy

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

Source from the content-addressed store, hash-verified

144 )
145
146 def test_make_query_strategy(self):
147 query_strategy = modAL.utils.combination.make_query_strategy(
148 utility_measure=modAL.uncertainty.classifier_uncertainty,
149 selector=modAL.utils.selection.multi_argmax
150 )
151
152 for n_samples in range(1, 10):
153 for n_classes in range(1, 10):
154 proba = np.random.rand(n_samples, n_classes)
155 proba = proba/np.sum(proba, axis=1).reshape(n_samples, 1)
156 X = np.random.rand(n_samples, 3)
157
158 learner = modAL.models.learners.ActiveLearner(
159 estimator=mock.MockEstimator(predict_proba_return=proba)
160 )
161
162 query_1 = query_strategy(learner, X)
163 query_2 = modAL.uncertainty.uncertainty_sampling(learner, X)
164
165 np.testing.assert_equal(query_1, query_2)
166
167 def test_data_vstack(self):
168 for n_samples, n_features in product(range(1, 10), range(1, 10)):

Callers

nothing calls this directly

Calls 1

query_strategyFunction · 0.85

Tested by

no test coverage detected