MCPcopy Create free account
hub / github.com/modAL-python/modAL / test_check_class_proba

Method test_check_class_proba

tests/core_tests.py:78–98  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

76 NotFittedError, modAL.utils.validation.check_class_labels, *unfitted_learner_list)
77
78 def test_check_class_proba(self):
79 for n_labels in range(2, 20):
80 # when all classes are known:
81 proba = np.random.rand(100, n_labels)
82 class_labels = list(range(n_labels))
83 np.testing.assert_almost_equal(
84 modAL.utils.check_class_proba(
85 proba, known_labels=class_labels, all_labels=class_labels),
86 proba
87 )
88 for unknown_idx in range(n_labels):
89 all_labels = list(range(n_labels))
90 known_labels = deepcopy(all_labels)
91 known_labels.remove(unknown_idx)
92 aug_proba = np.insert(
93 proba[:, known_labels], unknown_idx, np.zeros(len(proba)), axis=1)
94 np.testing.assert_almost_equal(
95 modAL.utils.check_class_proba(
96 proba[:, known_labels], known_labels=known_labels, all_labels=all_labels),
97 aug_proba
98 )
99
100 def test_linear_combination(self):
101

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected