(self)
| 655 | ) |
| 656 | |
| 657 | def test_uncertainty_sampling(self): |
| 658 | for n_samples in range(1, 10): |
| 659 | for n_classes in range(1, 10): |
| 660 | max_proba = np.zeros(n_classes) |
| 661 | for true_query_idx in range(n_samples): |
| 662 | predict_proba = np.random.rand(n_samples, n_classes) |
| 663 | predict_proba[true_query_idx] = max_proba |
| 664 | classifier = mock.MockEstimator( |
| 665 | predict_proba_return=predict_proba) |
| 666 | query_idx, query_metric = modAL.uncertainty.uncertainty_sampling( |
| 667 | classifier, np.random.rand(n_samples, n_classes) |
| 668 | ) |
| 669 | shuffled_query_idx, shuffled_query_metric = modAL.uncertainty.uncertainty_sampling( |
| 670 | classifier, np.random.rand(n_samples, n_classes), |
| 671 | random_tie_break=True |
| 672 | ) |
| 673 | np.testing.assert_array_equal(query_idx, true_query_idx) |
| 674 | np.testing.assert_array_equal( |
| 675 | shuffled_query_idx, true_query_idx) |
| 676 | |
| 677 | def test_margin_sampling(self): |
| 678 | for n_samples in range(1, 10): |
nothing calls this directly
no outgoing calls
no test coverage detected