From 94869295e49b5899b157a99151220ca0e0221e08 Mon Sep 17 00:00:00 2001 From: rasbt Date: Thu, 28 Mar 2024 10:49:06 -0500 Subject: [PATCH 1/8] update ci --- .github/workflows/python-package-conda.yml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/workflows/python-package-conda.yml b/.github/workflows/python-package-conda.yml index c94d2bc5f..405ddd6ce 100644 --- a/.github/workflows/python-package-conda.yml +++ b/.github/workflows/python-package-conda.yml @@ -18,16 +18,17 @@ jobs: uses: actions/setup-python@v2 with: python-version: 3.9 - - name: Add conda to system path + - name: run: | # $CONDA is an environment variable pointing to the root of the miniconda directory echo $CONDA/bin >> $GITHUB_PATH - name: Install packages and test with pytest run: | conda config --add channels conda-forge - conda update conda -y -q - conda env update --file environment.yml --name base - pip install scikit-learn==1.1.3 + conda create -n mlxtend python=3.10 --yes + conda activate mlxtend + conda env update environment.yml + pip install scikit-learn==1.1.3 pip install pandas==1.3.5 conda install tensorflow joblib pytest -y -q conda install imageio scikit-image -y -q From a56bf11325a28c1e59c055e625991b285bce28d1 Mon Sep 17 00:00:00 2001 From: rasbt Date: Thu, 28 Mar 2024 10:52:10 -0500 Subject: [PATCH 2/8] black update --- mlxtend/classifier/adaline.py | 1 - mlxtend/classifier/ensemble_vote.py | 1 - mlxtend/classifier/logistic_regression.py | 1 - mlxtend/classifier/multilayerperceptron.py | 1 - mlxtend/classifier/oner.py | 1 - mlxtend/classifier/perceptron.py | 1 - mlxtend/classifier/softmax_regression.py | 1 - mlxtend/classifier/stacking_classification.py | 1 - mlxtend/classifier/stacking_cv_classification.py | 1 - mlxtend/externals/pyprind/__init__.py | 1 - mlxtend/externals/pyprind/prog_class.py | 1 - mlxtend/externals/pyprind/progbar.py | 1 - mlxtend/feature_selection/exhaustive_feature_selector.py | 1 - mlxtend/feature_selection/sequential_feature_selector.py | 1 - mlxtend/plotting/plot_confusion_matrix.py | 8 +++++--- mlxtend/preprocessing/mean_centering.py | 1 - mlxtend/regressor/linear_regression.py | 1 - mlxtend/regressor/stacking_regression.py | 1 - mlxtend/utils/counter.py | 1 - 19 files changed, 5 insertions(+), 21 deletions(-) diff --git a/mlxtend/classifier/adaline.py b/mlxtend/classifier/adaline.py index 3951ab6bf..f9013b1ed 100644 --- a/mlxtend/classifier/adaline.py +++ b/mlxtend/classifier/adaline.py @@ -14,7 +14,6 @@ class Adaline(_BaseModel, _IterativeModel, _Classifier): - """ADAptive LInear NEuron classifier. Note that this implementation of Adaline expects binary class labels diff --git a/mlxtend/classifier/ensemble_vote.py b/mlxtend/classifier/ensemble_vote.py index 40763befe..e04d59228 100644 --- a/mlxtend/classifier/ensemble_vote.py +++ b/mlxtend/classifier/ensemble_vote.py @@ -19,7 +19,6 @@ class EnsembleVoteClassifier(BaseEstimator, ClassifierMixin, TransformerMixin): - """Soft Voting/Majority Rule classifier for scikit-learn estimators. Parameters diff --git a/mlxtend/classifier/logistic_regression.py b/mlxtend/classifier/logistic_regression.py index 2f9670d24..8b8a3f471 100644 --- a/mlxtend/classifier/logistic_regression.py +++ b/mlxtend/classifier/logistic_regression.py @@ -14,7 +14,6 @@ class LogisticRegression(_BaseModel, _IterativeModel, _Classifier): - """Logistic regression classifier. Note that this implementation of Logistic Regression diff --git a/mlxtend/classifier/multilayerperceptron.py b/mlxtend/classifier/multilayerperceptron.py index 7072df240..770dab9aa 100644 --- a/mlxtend/classifier/multilayerperceptron.py +++ b/mlxtend/classifier/multilayerperceptron.py @@ -17,7 +17,6 @@ class MultiLayerPerceptron( _BaseModel, _IterativeModel, _MultiClass, _MultiLayer, _Classifier ): - """Multi-layer perceptron classifier with logistic sigmoid activations Parameters diff --git a/mlxtend/classifier/oner.py b/mlxtend/classifier/oner.py index 891b6b1c2..78d33ef1a 100644 --- a/mlxtend/classifier/oner.py +++ b/mlxtend/classifier/oner.py @@ -17,7 +17,6 @@ class OneRClassifier(BaseEstimator, ClassifierMixin): - """OneR (One Rule) Classifier. Parameters diff --git a/mlxtend/classifier/perceptron.py b/mlxtend/classifier/perceptron.py index b50ed1752..30fb4b5b5 100644 --- a/mlxtend/classifier/perceptron.py +++ b/mlxtend/classifier/perceptron.py @@ -14,7 +14,6 @@ class Perceptron(_BaseModel, _IterativeModel, _Classifier): - """Perceptron classifier. Note that this implementation of the Perceptron expects binary class labels diff --git a/mlxtend/classifier/softmax_regression.py b/mlxtend/classifier/softmax_regression.py index 43723266e..56444e5f1 100644 --- a/mlxtend/classifier/softmax_regression.py +++ b/mlxtend/classifier/softmax_regression.py @@ -16,7 +16,6 @@ class SoftmaxRegression(_BaseModel, _IterativeModel, _Classifier, _MultiClass): - """Softmax regression classifier. Parameters diff --git a/mlxtend/classifier/stacking_classification.py b/mlxtend/classifier/stacking_classification.py index cf606e9a6..b442731e5 100644 --- a/mlxtend/classifier/stacking_classification.py +++ b/mlxtend/classifier/stacking_classification.py @@ -21,7 +21,6 @@ class StackingClassifier(_BaseXComposition, _BaseStackingClassifier, TransformerMixin): - """A Stacking classifier for scikit-learn estimators for classification. Parameters diff --git a/mlxtend/classifier/stacking_cv_classification.py b/mlxtend/classifier/stacking_cv_classification.py index 6fb69f978..77501abc5 100644 --- a/mlxtend/classifier/stacking_cv_classification.py +++ b/mlxtend/classifier/stacking_cv_classification.py @@ -26,7 +26,6 @@ class StackingCVClassifier( _BaseXComposition, _BaseStackingClassifier, TransformerMixin ): - """A 'Stacking Cross-Validation' classifier for scikit-learn estimators. New in mlxtend v0.4.3 diff --git a/mlxtend/externals/pyprind/__init__.py b/mlxtend/externals/pyprind/__init__.py index 148bef52f..1cd99f6ee 100755 --- a/mlxtend/externals/pyprind/__init__.py +++ b/mlxtend/externals/pyprind/__init__.py @@ -10,7 +10,6 @@ PyPI: https://pypi.python.org/pypi/PyPrind """ - from .generator_factory import prog_bar, prog_percent from .progbar import ProgBar from .progpercent import ProgPercent diff --git a/mlxtend/externals/pyprind/prog_class.py b/mlxtend/externals/pyprind/prog_class.py index d224496d2..b814b6a20 100755 --- a/mlxtend/externals/pyprind/prog_class.py +++ b/mlxtend/externals/pyprind/prog_class.py @@ -10,7 +10,6 @@ PyPI: https://pypi.python.org/pypi/PyPrind """ - import os import sys import time diff --git a/mlxtend/externals/pyprind/progbar.py b/mlxtend/externals/pyprind/progbar.py index 964946903..b5ffc374b 100755 --- a/mlxtend/externals/pyprind/progbar.py +++ b/mlxtend/externals/pyprind/progbar.py @@ -10,7 +10,6 @@ PyPI: https://pypi.python.org/pypi/PyPrind """ - import time from math import floor diff --git a/mlxtend/feature_selection/exhaustive_feature_selector.py b/mlxtend/feature_selection/exhaustive_feature_selector.py index e1a77b8db..bbbd1f846 100644 --- a/mlxtend/feature_selection/exhaustive_feature_selector.py +++ b/mlxtend/feature_selection/exhaustive_feature_selector.py @@ -26,7 +26,6 @@ class ExhaustiveFeatureSelector(BaseEstimator, MetaEstimatorMixin): - """Exhaustive Feature Selection for Classification and Regression. (new in v0.4.3) diff --git a/mlxtend/feature_selection/sequential_feature_selector.py b/mlxtend/feature_selection/sequential_feature_selector.py index a38a0ef2e..0a766ed16 100644 --- a/mlxtend/feature_selection/sequential_feature_selector.py +++ b/mlxtend/feature_selection/sequential_feature_selector.py @@ -25,7 +25,6 @@ class SequentialFeatureSelector(_BaseXComposition, MetaEstimatorMixin): - """Sequential Feature Selection for Classification and Regression. Parameters diff --git a/mlxtend/plotting/plot_confusion_matrix.py b/mlxtend/plotting/plot_confusion_matrix.py index e0e3f7404..6fe674195 100644 --- a/mlxtend/plotting/plot_confusion_matrix.py +++ b/mlxtend/plotting/plot_confusion_matrix.py @@ -156,9 +156,11 @@ def plot_confusion_matrix( s=cell_text, va="center", ha="center", - color="white" - if conf_mat[i, j] > np.max(conf_mat) * fontcolor_threshold - else "black", + color=( + "white" + if conf_mat[i, j] > np.max(conf_mat) * fontcolor_threshold + else "black" + ), ) if class_names is not None: tick_marks = np.arange(len(class_names)) diff --git a/mlxtend/preprocessing/mean_centering.py b/mlxtend/preprocessing/mean_centering.py index 856c234f7..840baba0c 100644 --- a/mlxtend/preprocessing/mean_centering.py +++ b/mlxtend/preprocessing/mean_centering.py @@ -10,7 +10,6 @@ class MeanCenterer(object): - """Column centering of vectors and matrices. Attributes diff --git a/mlxtend/regressor/linear_regression.py b/mlxtend/regressor/linear_regression.py index e726ef2a4..5ed8a8ae3 100644 --- a/mlxtend/regressor/linear_regression.py +++ b/mlxtend/regressor/linear_regression.py @@ -14,7 +14,6 @@ class LinearRegression(_BaseModel, _IterativeModel, _Regressor): - """Ordinary least squares linear regression. Parameters diff --git a/mlxtend/regressor/stacking_regression.py b/mlxtend/regressor/stacking_regression.py index 7ec00de45..295b7d7b1 100644 --- a/mlxtend/regressor/stacking_regression.py +++ b/mlxtend/regressor/stacking_regression.py @@ -19,7 +19,6 @@ class StackingRegressor(_BaseXComposition, RegressorMixin, TransformerMixin): - """A Stacking regressor for scikit-learn estimators for regression. Parameters diff --git a/mlxtend/utils/counter.py b/mlxtend/utils/counter.py index 79831ccd4..82c882ab2 100644 --- a/mlxtend/utils/counter.py +++ b/mlxtend/utils/counter.py @@ -11,7 +11,6 @@ class Counter(object): - """Class to display the progress of for-loop iterators. Parameters From 0b8c6c0b324a31947855c1f05263737208ff41d4 Mon Sep 17 00:00:00 2001 From: rasbt Date: Thu, 28 Mar 2024 10:53:09 -0500 Subject: [PATCH 3/8] conda init --- .github/workflows/python-package-conda.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/python-package-conda.yml b/.github/workflows/python-package-conda.yml index 405ddd6ce..e0a8289c2 100644 --- a/.github/workflows/python-package-conda.yml +++ b/.github/workflows/python-package-conda.yml @@ -26,6 +26,7 @@ jobs: run: | conda config --add channels conda-forge conda create -n mlxtend python=3.10 --yes + conda init conda activate mlxtend conda env update environment.yml pip install scikit-learn==1.1.3 From 2e5e46ab97b6eb48d1dffba0e59a93d26c686173 Mon Sep 17 00:00:00 2001 From: rasbt Date: Thu, 28 Mar 2024 10:58:29 -0500 Subject: [PATCH 4/8] fix workflow --- .github/workflows/python-package-conda.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/python-package-conda.yml b/.github/workflows/python-package-conda.yml index e0a8289c2..278aa4e5e 100644 --- a/.github/workflows/python-package-conda.yml +++ b/.github/workflows/python-package-conda.yml @@ -18,17 +18,17 @@ jobs: uses: actions/setup-python@v2 with: python-version: 3.9 - - name: + - name: Prepare environment variable run: | - # $CONDA is an environment variable pointing to the root of the miniconda directory - echo $CONDA/bin >> $GITHUB_PATH + echo "CONDA=$HOME/miniconda" >> $GITHUB_ENV + echo "$HOME/miniconda/bin" >> $GITHUB_PATH - name: Install packages and test with pytest run: | + source $CONDA/etc/profile.d/conda.sh conda config --add channels conda-forge conda create -n mlxtend python=3.10 --yes - conda init conda activate mlxtend - conda env update environment.yml + conda env update --file environment.yml pip install scikit-learn==1.1.3 pip install pandas==1.3.5 conda install tensorflow joblib pytest -y -q @@ -36,7 +36,7 @@ jobs: conda install dlib -y -q pip install markdown pip install coverage - pip install -e . + pip install -e . python -c "import numpy; print('NumPy:', numpy.__version__)" python -c "import scipy; print('SciPy:', scipy.__version__)" python -c "import sklearn; print('Scikit-learn:', sklearn.__version__)" @@ -44,4 +44,4 @@ jobs: coverage run --source=mlxtend --branch -m pytest mlxtend coverage xml - name: Upload Coverage to Codecov - uses: codecov/codecov-action@v2 + uses: codecov/codecov-action@v2 \ No newline at end of file From 9b983f387eca6551bf6c1614c920b73eaa6d95cb Mon Sep 17 00:00:00 2001 From: rasbt Date: Thu, 28 Mar 2024 11:03:18 -0500 Subject: [PATCH 5/8] fix workflow --- .github/workflows/python-package-conda.yml | 28 ++++++++++------------ 1 file changed, 12 insertions(+), 16 deletions(-) diff --git a/.github/workflows/python-package-conda.yml b/.github/workflows/python-package-conda.yml index 278aa4e5e..f7ec6cea6 100644 --- a/.github/workflows/python-package-conda.yml +++ b/.github/workflows/python-package-conda.yml @@ -14,28 +14,23 @@ jobs: steps: - uses: actions/checkout@v2 - - name: Set up Python 3.9 - uses: actions/setup-python@v2 + - name: Set up Miniconda + uses: conda-incubator/setup-miniconda@v2 with: + auto-update-conda: true python-version: 3.9 - - name: Prepare environment variable - run: | - echo "CONDA=$HOME/miniconda" >> $GITHUB_ENV - echo "$HOME/miniconda/bin" >> $GITHUB_PATH - - name: Install packages and test with pytest + channels: conda-forge + activate-environment: mlxtend + environment-file: environment.yml + create-env-file: true + + - name: Install dependencies and run tests + shell: bash -l {0} run: | - source $CONDA/etc/profile.d/conda.sh - conda config --add channels conda-forge - conda create -n mlxtend python=3.10 --yes - conda activate mlxtend - conda env update --file environment.yml - pip install scikit-learn==1.1.3 - pip install pandas==1.3.5 conda install tensorflow joblib pytest -y -q conda install imageio scikit-image -y -q conda install dlib -y -q - pip install markdown - pip install coverage + pip install scikit-learn==1.1.3 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__)" @@ -43,5 +38,6 @@ jobs: python -c "import pandas; print('Pandas:', pandas.__version__)" coverage run --source=mlxtend --branch -m pytest mlxtend coverage xml + - name: Upload Coverage to Codecov uses: codecov/codecov-action@v2 \ No newline at end of file From 48aab7dd7d7edd3fbf5a8b1619c28125aa57d35b Mon Sep 17 00:00:00 2001 From: rasbt Date: Thu, 28 Mar 2024 11:17:14 -0500 Subject: [PATCH 6/8] fix workflow --- .github/workflows/python-package-conda.yml | 3 ++- mlxtend/evaluate/tests/test_bias_variance_decomp.py | 5 ++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/python-package-conda.yml b/.github/workflows/python-package-conda.yml index f7ec6cea6..72b7191e5 100644 --- a/.github/workflows/python-package-conda.yml +++ b/.github/workflows/python-package-conda.yml @@ -11,7 +11,8 @@ jobs: runs-on: ubuntu-latest strategy: max-parallel: 5 - + env: + GITHUB_ACTIONS_CI: true steps: - uses: actions/checkout@v2 - name: Set up Miniconda diff --git a/mlxtend/evaluate/tests/test_bias_variance_decomp.py b/mlxtend/evaluate/tests/test_bias_variance_decomp.py index eb17c0511..367f82482 100644 --- a/mlxtend/evaluate/tests/test_bias_variance_decomp.py +++ b/mlxtend/evaluate/tests/test_bias_variance_decomp.py @@ -113,7 +113,10 @@ def test_mse_bagging(): APPVEYOR = False -@pytest.mark.skipif(TRAVIS or APPVEYOR, reason="TensorFlow dependency") +GITHUB_ACTIONS = os.getenv('GITHUB_ACTIONS_CI', 'false').lower() == 'true' + + +@pytest.mark.skipif(TRAVIS or APPVEYOR or GITHUB_ACTIONS, reason="TensorFlow dependency") def test_keras(): import tensorflow as tf From ebca143ce126f2fd559cc084d710ef49958d463f Mon Sep 17 00:00:00 2001 From: rasbt Date: Thu, 28 Mar 2024 11:18:58 -0500 Subject: [PATCH 7/8] skip tensorflow dependency --- mlxtend/evaluate/tests/test_bootstrap_point632.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/mlxtend/evaluate/tests/test_bootstrap_point632.py b/mlxtend/evaluate/tests/test_bootstrap_point632.py index 06c428721..f44958610 100644 --- a/mlxtend/evaluate/tests/test_bootstrap_point632.py +++ b/mlxtend/evaluate/tests/test_bootstrap_point632.py @@ -158,7 +158,10 @@ def test_scoring_proba(): APPVEYOR = False -@pytest.mark.skipif(TRAVIS or APPVEYOR, reason="TensorFlow dependency") +GITHUB_ACTIONS = os.getenv('GITHUB_ACTIONS_CI', 'false').lower() == 'true' + + +@pytest.mark.skipif(TRAVIS or APPVEYOR or GITHUB_ACTIONS, reason="TensorFlow dependency") def test_keras_fitparams(): import tensorflow as tf From 50a32c67dd8138b70b8389fb07406a7b52b56ad7 Mon Sep 17 00:00:00 2001 From: rasbt Date: Thu, 28 Mar 2024 11:20:56 -0500 Subject: [PATCH 8/8] formatting --- mlxtend/evaluate/tests/test_bias_variance_decomp.py | 6 ++++-- mlxtend/evaluate/tests/test_bootstrap_point632.py | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/mlxtend/evaluate/tests/test_bias_variance_decomp.py b/mlxtend/evaluate/tests/test_bias_variance_decomp.py index 367f82482..a5ca57cd0 100644 --- a/mlxtend/evaluate/tests/test_bias_variance_decomp.py +++ b/mlxtend/evaluate/tests/test_bias_variance_decomp.py @@ -113,10 +113,12 @@ def test_mse_bagging(): APPVEYOR = False -GITHUB_ACTIONS = os.getenv('GITHUB_ACTIONS_CI', 'false').lower() == 'true' +GITHUB_ACTIONS = os.getenv("GITHUB_ACTIONS_CI", "false").lower() == "true" -@pytest.mark.skipif(TRAVIS or APPVEYOR or GITHUB_ACTIONS, reason="TensorFlow dependency") +@pytest.mark.skipif( + TRAVIS or APPVEYOR or GITHUB_ACTIONS, reason="TensorFlow dependency" +) def test_keras(): import tensorflow as tf diff --git a/mlxtend/evaluate/tests/test_bootstrap_point632.py b/mlxtend/evaluate/tests/test_bootstrap_point632.py index f44958610..7034c643f 100644 --- a/mlxtend/evaluate/tests/test_bootstrap_point632.py +++ b/mlxtend/evaluate/tests/test_bootstrap_point632.py @@ -158,10 +158,12 @@ def test_scoring_proba(): APPVEYOR = False -GITHUB_ACTIONS = os.getenv('GITHUB_ACTIONS_CI', 'false').lower() == 'true' +GITHUB_ACTIONS = os.getenv("GITHUB_ACTIONS_CI", "false").lower() == "true" -@pytest.mark.skipif(TRAVIS or APPVEYOR or GITHUB_ACTIONS, reason="TensorFlow dependency") +@pytest.mark.skipif( + TRAVIS or APPVEYOR or GITHUB_ACTIONS, reason="TensorFlow dependency" +) def test_keras_fitparams(): import tensorflow as tf