From 066e816235a46334c1c4a2cb76383c360a749ea5 Mon Sep 17 00:00:00 2001 From: Christian Clauss Date: Sat, 26 Sep 2020 17:00:22 +0200 Subject: [PATCH 01/13] Travis CI: Test on Python 3.9 release candidate 2 --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index d2394b4097f3..a4b01023d8e1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,7 +1,7 @@ os: linux dist: focal language: python -python: 3.8 +python: 3.9-dev cache: pip before_install: pip install --upgrade pip setuptools six install: pip install black flake8 From a3af892fc400936063c07519e3b94e83a4f841cd Mon Sep 17 00:00:00 2001 From: github-actions <${GITHUB_ACTOR}@users.noreply.github.com> Date: Sat, 26 Sep 2020 15:01:03 +0000 Subject: [PATCH 02/13] fixup! Format Python code with psf/black push --- machine_learning/gradient_boosting_regressor.py | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/machine_learning/gradient_boosting_regressor.py b/machine_learning/gradient_boosting_regressor.py index 045aa056ec2f..0aa0e7a10ac5 100644 --- a/machine_learning/gradient_boosting_regressor.py +++ b/machine_learning/gradient_boosting_regressor.py @@ -3,11 +3,11 @@ predict house price. """ -import pandas as pd import matplotlib.pyplot as plt +import pandas as pd from sklearn.datasets import load_boston -from sklearn.metrics import mean_squared_error, r2_score from sklearn.ensemble import GradientBoostingRegressor +from sklearn.metrics import mean_squared_error, r2_score from sklearn.model_selection import train_test_split @@ -42,10 +42,7 @@ def main(): training_score = model.score(X_train, y_train).round(3) test_score = model.score(X_test, y_test).round(3) print("Training score of GradientBoosting is :", training_score) - print( - "The test score of GradientBoosting is :", - test_score - ) + print("The test score of GradientBoosting is :", test_score) # Let us evaluation the model by finding the errors y_pred = model.predict(X_test) @@ -57,8 +54,7 @@ def main(): # So let's run the model against the test data fig, ax = plt.subplots() ax.scatter(y_test, y_pred, edgecolors=(0, 0, 0)) - ax.plot([y_test.min(), y_test.max()], - [y_test.min(), y_test.max()], "k--", lw=4) + ax.plot([y_test.min(), y_test.max()], [y_test.min(), y_test.max()], "k--", lw=4) ax.set_xlabel("Actual") ax.set_ylabel("Predicted") ax.set_title("Truth vs Predicted") From 48158efd84e16f4c90a00264846240f9178c1c0f Mon Sep 17 00:00:00 2001 From: Christian Clauss Date: Sat, 26 Sep 2020 18:03:29 +0200 Subject: [PATCH 03/13] tensorflow; python_version <= '3.8' --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index b070ffdf611d..488c26eea358 100644 --- a/requirements.txt +++ b/requirements.txt @@ -16,5 +16,5 @@ requests scikit-fuzzy sklearn sympy -tensorflow +tensorflow; python_version <= '3.8' xgboost From 25c9e6d42003ed69f2ee8018bb3d6193ab0d517b Mon Sep 17 00:00:00 2001 From: github-actions <${GITHUB_ACTOR}@users.noreply.github.com> Date: Sat, 26 Sep 2020 16:04:07 +0000 Subject: [PATCH 04/13] updating DIRECTORY.md --- DIRECTORY.md | 1 + 1 file changed, 1 insertion(+) diff --git a/DIRECTORY.md b/DIRECTORY.md index 3227711c7853..398506b40baa 100644 --- a/DIRECTORY.md +++ b/DIRECTORY.md @@ -319,6 +319,7 @@ * [Data Transformations](https://github.com/TheAlgorithms/Python/blob/master/machine_learning/data_transformations.py) * [Decision Tree](https://github.com/TheAlgorithms/Python/blob/master/machine_learning/decision_tree.py) * [Gaussian Naive Bayes](https://github.com/TheAlgorithms/Python/blob/master/machine_learning/gaussian_naive_bayes.py) + * [Gradient Boosting Regressor](https://github.com/TheAlgorithms/Python/blob/master/machine_learning/gradient_boosting_regressor.py) * [Gradient Descent](https://github.com/TheAlgorithms/Python/blob/master/machine_learning/gradient_descent.py) * [K Means Clust](https://github.com/TheAlgorithms/Python/blob/master/machine_learning/k_means_clust.py) * [K Nearest Neighbours](https://github.com/TheAlgorithms/Python/blob/master/machine_learning/k_nearest_neighbours.py) From f7bba1f39d10e8bc0ccb49636739c19f4073e868 Mon Sep 17 00:00:00 2001 From: Christian Clauss Date: Sat, 26 Sep 2020 18:25:36 +0200 Subject: [PATCH 05/13] Update .travis.yml --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index a4b01023d8e1..b7ca7c364e66 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,6 +12,7 @@ jobs: - black --check . || true - flake8 --ignore=E203,W503 --max-complexity=25 --max-line-length=88 --statistics --count . - scripts/validate_filenames.py # no uppercase, no spaces, in a directory + - atp-get install python3-numpy # TEMPORARY: Just for Python 3.9-rc2 - pip install -r requirements.txt # fast fail on black, flake8, validate_filenames script: - mypy --ignore-missing-imports . || true # https://github.com/python/mypy/issues/7907 From 50c518fbbcff8c396b53a886b38d030402fab3be Mon Sep 17 00:00:00 2001 From: Christian Clauss Date: Sat, 26 Sep 2020 18:26:15 +0200 Subject: [PATCH 06/13] Update .travis.yml --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index b7ca7c364e66..c93f610e2276 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,7 +12,7 @@ jobs: - black --check . || true - flake8 --ignore=E203,W503 --max-complexity=25 --max-line-length=88 --statistics --count . - scripts/validate_filenames.py # no uppercase, no spaces, in a directory - - atp-get install python3-numpy # TEMPORARY: Just for Python 3.9-rc2 + - apt-get install python3-numpy # TEMPORARY: Just for Python 3.9-rc2 - pip install -r requirements.txt # fast fail on black, flake8, validate_filenames script: - mypy --ignore-missing-imports . || true # https://github.com/python/mypy/issues/7907 From 24fc5a655954a4a1bf70212a13dff9b083c5b23f Mon Sep 17 00:00:00 2001 From: Christian Clauss Date: Sat, 26 Sep 2020 18:40:50 +0200 Subject: [PATCH 07/13] Update .travis.yml --- .travis.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index c93f610e2276..7265ef71a541 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,5 +1,11 @@ os: linux dist: focal +addons: + apt: + update: true + packages: + - python3-numpy # TEMPORARY: Just for Python 3.9-rc2 + language: python python: 3.9-dev cache: pip @@ -12,7 +18,6 @@ jobs: - black --check . || true - flake8 --ignore=E203,W503 --max-complexity=25 --max-line-length=88 --statistics --count . - scripts/validate_filenames.py # no uppercase, no spaces, in a directory - - apt-get install python3-numpy # TEMPORARY: Just for Python 3.9-rc2 - pip install -r requirements.txt # fast fail on black, flake8, validate_filenames script: - mypy --ignore-missing-imports . || true # https://github.com/python/mypy/issues/7907 From b32837f204ad7f13e5d58672d022ad9d0f22eb92 Mon Sep 17 00:00:00 2001 From: Christian Clauss Date: Sat, 26 Sep 2020 18:55:16 +0200 Subject: [PATCH 08/13] Update .travis.yml --- .travis.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 7265ef71a541..5e98f1eb03c8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,11 +1,11 @@ os: linux dist: focal -addons: +addons: # TEMPORARY: Just for Python 3.9-rc2 apt: update: true packages: - - python3-numpy # TEMPORARY: Just for Python 3.9-rc2 - + - python3-numpy + - python3-scipy language: python python: 3.9-dev cache: pip From b5d5ba0d755fc5eb3f3f00feb5c18cb919937963 Mon Sep 17 00:00:00 2001 From: Christian Clauss Date: Sat, 26 Sep 2020 19:19:25 +0200 Subject: [PATCH 09/13] Update .travis.yml --- .travis.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 5e98f1eb03c8..aca011e9628e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,8 +4,7 @@ addons: # TEMPORARY: Just for Python 3.9-rc2 apt: update: true packages: - - python3-numpy - - python3-scipy + - python3-keras language: python python: 3.9-dev cache: pip From fe7a4e9aeed216caab74163d40248774a2a822c5 Mon Sep 17 00:00:00 2001 From: Christian Clauss Date: Sat, 26 Sep 2020 19:45:41 +0200 Subject: [PATCH 10/13] Update requirements.txt --- requirements.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/requirements.txt b/requirements.txt index 488c26eea358..d50745078825 100644 --- a/requirements.txt +++ b/requirements.txt @@ -2,7 +2,7 @@ beautifulsoup4 black fake_useragent flake8 -keras +keras; python_version <= '3.8' lxml matplotlib mypy @@ -13,8 +13,8 @@ pillow pytest pytest-cov requests -scikit-fuzzy +scikit-fuzzy; python_version <= '3.8' sklearn sympy tensorflow; python_version <= '3.8' -xgboost +xgboost; python_version <= '3.8' From fb85c03003b7680bd724e4d43c361975d7a8c606 Mon Sep 17 00:00:00 2001 From: Christian Clauss Date: Sat, 26 Sep 2020 20:16:58 +0200 Subject: [PATCH 11/13] Update requirements.txt --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index d50745078825..449d6038a425 100644 --- a/requirements.txt +++ b/requirements.txt @@ -14,7 +14,7 @@ pytest pytest-cov requests scikit-fuzzy; python_version <= '3.8' -sklearn +sklearn; python_version <= '3.8' sympy tensorflow; python_version <= '3.8' xgboost; python_version <= '3.8' From 35134bf34c0a00763dcc26a1677608e5822779cb Mon Sep 17 00:00:00 2001 From: Christian Clauss Date: Sun, 27 Sep 2020 00:27:56 +0200 Subject: [PATCH 12/13] Update .travis.yml --- .travis.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.travis.yml b/.travis.yml index aca011e9628e..1154771f82fc 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,6 +5,8 @@ addons: # TEMPORARY: Just for Python 3.9-rc2 update: true packages: - python3-keras + - python3-pandas + - python3-sklearn language: python python: 3.9-dev cache: pip From d5b182a0f82753794b5d7167eeaa332bf3ceca82 Mon Sep 17 00:00:00 2001 From: Christian Clauss Date: Sun, 27 Sep 2020 00:28:33 +0200 Subject: [PATCH 13/13] Update requirements.txt --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 449d6038a425..5f28ab733f21 100644 --- a/requirements.txt +++ b/requirements.txt @@ -8,7 +8,7 @@ matplotlib mypy numpy opencv-python -pandas +pandas; python_version <= '3.8' pillow pytest pytest-cov