(self)
| 675 | shuffled_query_idx, true_query_idx) |
| 676 | |
| 677 | def test_margin_sampling(self): |
| 678 | for n_samples in range(1, 10): |
| 679 | for n_classes in range(2, 10): |
| 680 | for true_query_idx in range(n_samples): |
| 681 | predict_proba = np.zeros(shape=(n_samples, n_classes)) |
| 682 | predict_proba[:, 0] = 1.0 |
| 683 | predict_proba[true_query_idx, 0] = 0.0 |
| 684 | classifier = mock.MockEstimator( |
| 685 | predict_proba_return=predict_proba) |
| 686 | |
| 687 | query_idx, query_metric = modAL.uncertainty.margin_sampling( |
| 688 | classifier, np.random.rand(n_samples, n_classes) |
| 689 | ) |
| 690 | shuffled_query_idx, shuffled_query_metric = modAL.uncertainty.margin_sampling( |
| 691 | classifier, np.random.rand(n_samples, n_classes), |
| 692 | random_tie_break=True |
| 693 | ) |
| 694 | np.testing.assert_array_equal(query_idx, true_query_idx) |
| 695 | np.testing.assert_array_equal( |
| 696 | shuffled_query_idx, true_query_idx) |
| 697 | |
| 698 | def test_entropy_sampling(self): |
| 699 | for n_samples in range(1, 10): |
nothing calls this directly
no outgoing calls
no test coverage detected