def test_check_pct_accuracy_value(pct_accuracy): pool_classifiers = create_pool_classifiers() with pytest.raises(ValueError): desmi = DESMI(pool_classifiers, pct_accuracy=pct_accuracy) desmi.fit(X_dsel_ex1, y_dsel_ex1)
def test_check_alpha_type(alpha): pool_classifiers = create_pool_classifiers() with pytest.raises(TypeError): desmi = DESMI(pool_classifiers, alpha=alpha) desmi.fit(X_dsel_ex1, y_dsel_ex1)
def test_mi(knn_methods): pool_classifiers, X_dsel, y_dsel, X_test, y_test = setup_classifiers() desmi = DESMI(pool_classifiers, alpha=0.9, knn_classifier=knn_methods) desmi.fit(X_dsel, y_dsel) assert np.isclose(desmi.score(X_test, y_test), 0.9787234042553191)
def test_mi(): pool_classifiers, X_dsel, y_dsel, X_test, y_test = setup_classifiers() desmi = DESMI(pool_classifiers, alpha=0.9) desmi.fit(X_dsel, y_dsel) assert np.isclose(desmi.score(X_test, y_test), 0.3500000000)
def test_check_pct_accuracy_value(pct_accuracy, create_X_y): X, y = create_X_y with pytest.raises(ValueError): desmi = DESMI(pct_accuracy=pct_accuracy) desmi.fit(X, y)
def test_check_alpha_type(alpha, create_X_y): X, y = create_X_y with pytest.raises(TypeError): desmi = DESMI(alpha=alpha) desmi.fit(X, y)