示例#1
0
def test_not_predict_proba():
    X = X_dsel_ex1
    y = y_dsel_ex1
    classifier = MagicMock()
    classifier.predict.return_value = [0]
    single_best_test = SingleBest([classifier] * 10)
    single_best_test.fit(X, y)
    with pytest.raises(ValueError):
        single_best_test.predict_proba(X)
示例#2
0
def test_not_predict_proba(create_X_y):
    X, y = create_X_y

    classifier = MagicMock()
    classifier.predict.return_value = [0]
    single_best_test = SingleBest([classifier] * 10)
    single_best_test.fit(X, y)
    with pytest.raises(ValueError):
        single_best_test.predict_proba(X)
示例#3
0
def test_predict_proba():
    X = X_dsel_ex1
    y = y_dsel_ex1
    pool_classifiers = create_pool_classifiers()
    single_best_test = SingleBest(pool_classifiers)
    single_best_test.fit(X, y)

    predicted_proba = single_best_test.predict_proba(X)
    assert np.equal(predicted_proba, pool_classifiers[0].predict_proba(X)).all()
示例#4
0
def test_predict_proba(create_X_y, create_pool_classifiers):
    X, y = create_X_y

    pool_classifiers = create_pool_classifiers
    single_best_test = SingleBest(pool_classifiers)
    single_best_test.fit(X, y)

    predicted_proba = single_best_test.predict_proba(X)
    assert np.equal(predicted_proba,
                    pool_classifiers[0].predict_proba(X)).all()