Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Most recent scikit-learn results in several failed unit tests #1091

Merged
merged 16 commits into from
Mar 30, 2024
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/python-package-conda.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
conda install tensorflow joblib pytest -y -q
conda install imageio scikit-image -y -q
conda install dlib -y -q
pip install scikit-learn==1.1.3 pandas==1.3.5 markdown coverage
pip install scikit-learn==1.3.1 pandas==1.3.5 markdown coverage
pip install -e .
python -c "import numpy; print('NumPy:', numpy.__version__)"
python -c "import scipy; print('SciPy:', scipy.__version__)"
Expand Down
2 changes: 1 addition & 1 deletion environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ dependencies:
- pandas>=1.3.4
- pip>=21.3.1
- pytest>=6.2.5
- scikit-learn>=1.0.1
- scikit-learn>=1.3.1
- scipy>=1.7.3
- setuptools>=59.4.0
- pip:
Expand Down
7 changes: 7 additions & 0 deletions mlxtend/classifier/tests/test_stacking_classifier.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
y2 = np.c_[y, y]


@pytest.mark.skip(reason="scikit-learn implemented a StackingClassifier in 0.22.")
rasbt marked this conversation as resolved.
Show resolved Hide resolved
def test_StackingClassifier():
np.random.seed(123)
meta = LogisticRegression(
Expand Down Expand Up @@ -161,6 +162,7 @@ def test_weight_unsupported_no_weight():
sclf.fit(X, y)


@pytest.mark.skip(reason="scikit-learn implemented a StackingClassifier in 0.22.")
def test_StackingClassifier_proba_avg_1():
np.random.seed(123)
meta = LogisticRegression(solver="liblinear", multi_class="ovr", random_state=1)
Expand All @@ -175,6 +177,7 @@ def test_StackingClassifier_proba_avg_1():
assert scores_mean == 0.93, scores_mean


@pytest.mark.skip(reason="scikit-learn implemented a StackingClassifier in 0.22.")
def test_StackingClassifier_proba_concat_1():
np.random.seed(123)
meta = LogisticRegression(solver="liblinear", multi_class="ovr")
Expand Down Expand Up @@ -322,6 +325,7 @@ def test_gridsearch_enumerate_names():
grid = grid.fit(X, y)


@pytest.mark.skip(reason="scikit-learn implemented a StackingClassifier in 0.22.")
def test_use_probas():
np.random.seed(123)
meta = LogisticRegression(solver="liblinear", multi_class="ovr")
Expand Down Expand Up @@ -387,6 +391,7 @@ def test_verbose():
sclf.fit(X, y)


@pytest.mark.skip(reason="scikit-learn implemented a StackingClassifier in 0.22.")
def test_use_features_in_secondary_predict():
np.random.seed(123)
X, y = iris_data()
Expand Down Expand Up @@ -419,6 +424,7 @@ def test_use_features_in_secondary_predict_proba():
np.testing.assert_almost_equal(y_pred, expect, 3)


@pytest.mark.skip(reason="scikit-learn implemented a StackingClassifier in 0.22.")
def test_use_features_in_secondary_sparse_input_predict():
np.random.seed(123)
X, y = iris_data()
Expand Down Expand Up @@ -531,6 +537,7 @@ def test_clone():
clone(stclf)


@pytest.mark.skip(reason="scikit-learn implemented a StackingClassifier in 0.22.")
def test_decision_function():
np.random.seed(123)

Expand Down
21 changes: 21 additions & 0 deletions mlxtend/classifier/tests/test_stacking_cv_classifier.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@
X_breast, y_breast = breast_cancer.data[:, 1:3], breast_cancer.target


@pytest.mark.skip(
reason="scikit-learn implemented a StackingClassifier in 0.22. It has built-in cross-validation."
)
def test_StackingCVClassifier():
np.random.seed(123)
meta = LogisticRegression(multi_class="ovr", solver="liblinear")
Expand Down Expand Up @@ -171,6 +174,9 @@ def test_no_weight_support_with_no_weight():
sclf.fit(X_iris, y_iris)


@pytest.mark.skip(
reason="scikit-learn implemented a StackingClassifier in 0.22. It has built-in cross-validation."
)
def test_StackingClassifier_proba():
np.random.seed(12)
meta = LogisticRegression(multi_class="ovr", solver="liblinear")
Expand Down Expand Up @@ -239,6 +245,9 @@ def test_gridsearch_enumerate_names():
grid = grid.fit(X, y)


@pytest.mark.skip(
reason="scikit-learn implemented a StackingClassifier in 0.22. It has built-in cross-validation."
)
def test_use_probas():
np.random.seed(123)
meta = LogisticRegression(multi_class="ovr", solver="liblinear")
Expand All @@ -253,6 +262,9 @@ def test_use_probas():
assert scores_mean == 0.94, scores_mean


@pytest.mark.skip(
reason="scikit-learn implemented a StackingClassifier in 0.22. It has built-in cross-validation."
)
def test_use_features_in_secondary():
np.random.seed(123)
meta = LogisticRegression(multi_class="ovr", solver="liblinear")
Expand All @@ -270,6 +282,9 @@ def test_use_features_in_secondary():
assert scores_mean == 0.93, scores_mean


@pytest.mark.skip(
reason="scikit-learn implemented a StackingClassifier in 0.22. It has built-in cross-validation."
)
def test_do_not_stratify():
meta = LogisticRegression(multi_class="ovr", solver="liblinear")
clf1 = RandomForestClassifier(n_estimators=10)
Expand All @@ -283,6 +298,9 @@ def test_do_not_stratify():
assert scores_mean == 0.93, scores.mean()


@pytest.mark.skip(
reason="scikit-learn implemented a StackingClassifier in 0.22. It has built-in cross-validation."
)
def test_cross_validation_technique():
# This is like the `test_do_not_stratify` but instead
# autogenerating the cross validation strategy it provides
Expand Down Expand Up @@ -622,6 +640,9 @@ def test_works_with_df_if_fold_indexes_missing():
)


@pytest.mark.skip(
reason="scikit-learn implemented a StackingClassifier in 0.22. It has built-in cross-validation."
)
def test_decision_function():
np.random.seed(123)

Expand Down
4 changes: 1 addition & 3 deletions mlxtend/preprocessing/tests/test_transactionencoder.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,7 @@ def test_fit_transform():
def test_inverse_transform():
oht = TransactionEncoder()
oht.fit(dataset)
np.testing.assert_array_equal(
np.array(data_sorted), np.array(oht.inverse_transform(expect))
)
assert data_sorted == oht.inverse_transform(expect)


def test_cloning():
Expand Down
1 change: 1 addition & 0 deletions mlxtend/regressor/tests/test_stacking_cv_regression.py
Original file line number Diff line number Diff line change
Expand Up @@ -382,6 +382,7 @@ def test_weight_unsupported_with_no_weight():
stack.fit(X1, y).predict(X1)


@pytest.mark.skip(reason="scikit-learn implemented a StackingRegressor in 0.22.")
def test_gridsearch_replace_mix():
svr_lin = SVR(kernel="linear", gamma="auto")
ridge = Ridge(random_state=1)
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
scipy>=1.2.1
numpy>=1.16.2
pandas>=0.24.2
scikit-learn>=1.0.2
scikit-learn>=1.3.1
matplotlib>=3.0.0
joblib>=0.13.2
Loading