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)
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)
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()
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()