(self)
| 538 | |
| 539 | class TestEER(unittest.TestCase): |
| 540 | def test_eer(self): |
| 541 | for n_pool, n_features, n_classes in product(range(5, 10), range(1, 5), range(2, 5)): |
| 542 | X_training_, y_training = np.random.rand( |
| 543 | 10, n_features).tolist(), np.random.randint(0, n_classes, size=10) |
| 544 | X_pool_, y_pool = np.random.rand(n_pool, n_features).tolist( |
| 545 | ), np.random.randint(0, n_classes+1, size=n_pool) |
| 546 | |
| 547 | for data_type in (sp.csr_matrix, pd.DataFrame, np.array, list): |
| 548 | X_training, X_pool = data_type(X_training_), data_type(X_pool_) |
| 549 | |
| 550 | learner = modAL.models.ActiveLearner(RandomForestClassifier(n_estimators=2), |
| 551 | X_training=X_training, y_training=y_training) |
| 552 | |
| 553 | modAL.expected_error.expected_error_reduction(learner, X_pool) |
| 554 | modAL.expected_error.expected_error_reduction( |
| 555 | learner, X_pool, random_tie_break=True) |
| 556 | modAL.expected_error.expected_error_reduction( |
| 557 | learner, X_pool, p_subsample=0.1) |
| 558 | modAL.expected_error.expected_error_reduction( |
| 559 | learner, X_pool, loss='binary') |
| 560 | modAL.expected_error.expected_error_reduction( |
| 561 | learner, X_pool, p_subsample=0.1, loss='log') |
| 562 | self.assertRaises(AssertionError, modAL.expected_error.expected_error_reduction, |
| 563 | learner, X_pool, p_subsample=1.5) |
| 564 | self.assertRaises(AssertionError, modAL.expected_error.expected_error_reduction, |
| 565 | learner, X_pool, loss=42) |
| 566 | |
| 567 | |
| 568 | class TestUncertainties(unittest.TestCase): |
nothing calls this directly
no outgoing calls
no test coverage detected