示例#1
0
def test_select():
    knop_test = KNOP(create_pool_classifiers())
    competences = np.ones(3)
    competences[0] = 0
    expected = np.atleast_2d([False, True, True])
    selected = knop_test.select(competences)
    assert np.array_equal(expected, selected)
示例#2
0
def test_weights_zero():
    knop_test = KNOP(create_pool_classifiers())
    knop_test.fit(X_dsel_ex1, y_dsel_ex1)
    competences = np.zeros((1, 3))
    result = knop_test.select(competences)

    assert np.all(result)
示例#3
0
def test_weights_zero():
    query = np.atleast_2d([1, 1])

    knop_test = KNOP(create_pool_classifiers())
    knop_test.fit(X_dsel_ex1, y_dsel_ex1)

    knop_test.estimate_competence = MagicMock(return_value=np.zeros(3))

    result = knop_test.select(query)
    assert np.array_equal(result, np.array([0, 1, 0]))
def test_weights_zero():
    knop_test = KNOP()
    competences = np.zeros((1, 3))
    result = knop_test.select(competences)

    assert np.all(result)