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

Method test_set_max

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

Source from the content-addressed store, hash-verified

1225
1226class TestBayesianOptimizer(unittest.TestCase):
1227 def test_set_max(self):
1228 # case 1: the estimator is not fitted yet
1229 regressor = mock.MockEstimator()
1230 learner = modAL.models.learners.BayesianOptimizer(estimator=regressor)
1231 self.assertEqual(-np.inf, learner.y_max)
1232
1233 # case 2: the estimator is fitted already
1234 for n_samples in range(1, 100):
1235 X = np.random.rand(n_samples, 2)
1236 y = np.random.rand(n_samples, )
1237 max_val = np.max(y)
1238
1239 regressor = mock.MockEstimator()
1240 learner = modAL.models.learners.BayesianOptimizer(
1241 estimator=regressor,
1242 X_training=X, y_training=y
1243 )
1244 np.testing.assert_almost_equal(max_val, learner.y_max)
1245
1246 def test_set_new_max(self):
1247 for n_reps in range(100):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected