diff --git a/.github/workflows/python-package-conda.yml b/.github/workflows/python-package-conda.yml index c94d2bc5f..72b7191e5 100644 --- a/.github/workflows/python-package-conda.yml +++ b/.github/workflows/python-package-conda.yml @@ -11,35 +11,34 @@ jobs: runs-on: ubuntu-latest strategy: max-parallel: 5 - + env: + GITHUB_ACTIONS_CI: true 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: Add conda to system path - 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 + 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: | - 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 - 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 -e . + 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__)" python -c "import sklearn; print('Scikit-learn:', sklearn.__version__)" 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 + uses: codecov/codecov-action@v2 \ No newline at end of file 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/evaluate/tests/test_bias_variance_decomp.py b/mlxtend/evaluate/tests/test_bias_variance_decomp.py index eb17c0511..a5ca57cd0 100644 --- a/mlxtend/evaluate/tests/test_bias_variance_decomp.py +++ b/mlxtend/evaluate/tests/test_bias_variance_decomp.py @@ -113,7 +113,12 @@ 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 diff --git a/mlxtend/evaluate/tests/test_bootstrap_point632.py b/mlxtend/evaluate/tests/test_bootstrap_point632.py index 06c428721..7034c643f 100644 --- a/mlxtend/evaluate/tests/test_bootstrap_point632.py +++ b/mlxtend/evaluate/tests/test_bootstrap_point632.py @@ -158,7 +158,12 @@ 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 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