| 1295 | np.testing.assert_equal(y_new[max_idx], learner.y_max) |
| 1296 | |
| 1297 | def test_get_max(self): |
| 1298 | for n_samples in range(1, 100): |
| 1299 | for max_idx in range(0, n_samples): |
| 1300 | X = np.random.rand(n_samples, 3) |
| 1301 | y = np.random.rand(n_samples) |
| 1302 | y[max_idx] = 10 |
| 1303 | |
| 1304 | regressor = mock.MockEstimator() |
| 1305 | optimizer = modAL.models.learners.BayesianOptimizer( |
| 1306 | regressor, X_training=X, y_training=y) |
| 1307 | X_max, y_max = optimizer.get_max() |
| 1308 | np.testing.assert_equal(X_max, X[max_idx]) |
| 1309 | np.testing.assert_equal(y_max, y[max_idx]) |
| 1310 | |
| 1311 | def test_teach(self): |
| 1312 | for bootstrap, only_new in product([True, False], [True, False]): |