Exemple #1
0
def test_select():
    meta_test = METADES()
    competences = np.asarray(
        [0.8, 0.6, 0.7, 0.2, 0.3, 0.4, 0.6, 0.1, 1.0, 0.98])
    expected = np.asarray(
        [True, True, True, False, False, False, True, False, True, True])
    selected_matrix = meta_test.select(competences)
    assert np.array_equal(selected_matrix, expected.reshape(1, -1))
Exemple #2
0
def test_select_batch():
    meta_test = METADES()
    competences = np.tile(
        np.array([0.8, 0.6, 0.7, 0.2, 0.3, 0.4, 0.6, 0.1, 1.0, 0.98]), (10, 1))
    expected = np.tile(
        [True, True, True, False, False, False, True, False, True, True],
        (10, 1))
    selected_matrix = meta_test.select(competences)
    assert np.array_equal(selected_matrix, expected)
Exemple #3
0
def test_select_no_competent_classifiers():
    meta_test = METADES(create_pool_classifiers())
    competences = np.zeros(meta_test.n_classifiers)
    indices = meta_test.select(competences)
    assert indices == list(range(meta_test.n_classifiers))
Exemple #4
0
def test_select():
    meta_test = METADES(create_pool_classifiers())
    competences = np.array([0.8, 0.6, 0.7, 0.2, 0.3, 0.4, 0.6, 0.1, 1.0, 0.98])
    indices = meta_test.select(competences)
    assert set(indices) == {0, 1, 2, 6, 8, 9}
Exemple #5
0
def test_select_no_competent_classifiers_batch():
    meta_test = METADES()
    meta_test.n_classifiers_ = 3
    competences = np.zeros((10, meta_test.n_classifiers_))
    selected_matrix = meta_test.select(competences)
    assert np.all(selected_matrix)