def test_source_competence_kl(): entropy_test = DESKL() entropy_test.n_classifiers_ = 1 entropy_test.dsel_scores_ = np.array([[[0.33, 0.33, 0.33], [1.0, 0.0, 0.0], [1.0, 0.0, 0.0]]]).reshape(3, 1, 3) entropy_test.DSEL_processed_ = np.array([[False], [True], [False]]) entropy_test.n_classes_ = 3 entropy_test.n_samples_ = 3 C_src = entropy_test.source_competence() expected = np.array([[0.0], [1.0], [-1.0]]) assert np.allclose(C_src, expected, atol=0.01)
def test_source_competence_kl(): pool_classifiers = [ create_base_classifier(return_value=1, return_prob=1.0) ] entropy_test = DESKL(pool_classifiers=pool_classifiers) entropy_test.n_classifiers_ = len(pool_classifiers) # 3 Samples, 1 classifier, 3 classes entropy_test.dsel_scores_ = np.array([[[0.33, 0.33, 0.33], [1.0, 0.0, 0.0], [1.0, 0.0, 0.0]]]).reshape(3, 1, 3) entropy_test.DSEL_processed_ = np.array([[False], [True], [False]]) entropy_test.n_classes_ = 3 entropy_test.n_samples_ = 3 C_src = entropy_test.source_competence() expected = np.array([[0.0], [1.0], [-1.0]]) assert np.allclose(C_src, expected, atol=0.01)