示例#1
0
def test_estimate_competence_batch(example_estimate_competence):
    _, _, neighbors, distances, dsel_processed, _ = example_estimate_competence
    expected = np.array([[0.57142857, 0.71428571, 0.71428571],
                         [0.71428571, 0.85714286, 0.71428571],
                         [0.57142857, 0.71428571, 0.57142857]])

    ola_test = OLA()
    ola_test.DSEL_processed_ = dsel_processed

    ola_test.DFP_mask = np.ones((3, 3))
    competences = ola_test.estimate_competence(neighbors, distances=distances)
    assert np.allclose(competences, expected)
示例#2
0
def test_estimate_competence_batch():
    expected = np.array([[0.57142857,  0.71428571,  0.71428571],
                         [0.71428571,  0.85714286,  0.71428571],
                         [0.57142857, 0.71428571, 0.57142857]])

    ola_test = OLA(create_pool_classifiers())
    ola_test.DSEL_processed_ = dsel_processed_ex1
    neighbors = neighbors_ex1
    distances = distances_ex1
    ola_test.DFP_mask = np.ones((3, 3))
    query = np.array([[1, 1], [1, 1], [1, 1]])
    competences = ola_test.estimate_competence(query, neighbors, distances=distances)
    assert np.allclose(competences, expected)