| 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]): |
| 1313 | # case 1. optimizer is uninitialized |
| 1314 | for n_samples in range(1, 100): |
| 1315 | for n_features in range(1, 100): |
| 1316 | regressor = mock.MockEstimator() |
| 1317 | learner = modAL.models.learners.BayesianOptimizer( |
| 1318 | estimator=regressor) |
| 1319 | |
| 1320 | X = np.random.rand(n_samples, 2) |
| 1321 | y = np.random.rand(n_samples) |
| 1322 | learner.teach(X, y, bootstrap=bootstrap, only_new=only_new) |
| 1323 | |
| 1324 | # case 2. optimizer is initialized |
| 1325 | for n_samples in range(1, 100): |
| 1326 | for n_features in range(1, 100): |
| 1327 | X = np.random.rand(n_samples, 2) |
| 1328 | y = np.random.rand(n_samples) |
| 1329 | |
| 1330 | regressor = mock.MockEstimator() |
| 1331 | learner = modAL.models.learners.BayesianOptimizer( |
| 1332 | estimator=regressor, |
| 1333 | X_training=X, y_training=y |
| 1334 | ) |
| 1335 | learner.teach(X, y, bootstrap=bootstrap, only_new=only_new) |
| 1336 | |
| 1337 | def test_on_transformed(self): |
| 1338 | n_samples = 10 |