diff --git a/.travis.yml b/.travis.yml index d2394b4097f3..1154771f82fc 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,7 +1,14 @@ os: linux dist: focal +addons: # TEMPORARY: Just for Python 3.9-rc2 + apt: + update: true + packages: + - python3-keras + - python3-pandas + - python3-sklearn language: python -python: 3.8 +python: 3.9-dev cache: pip before_install: pip install --upgrade pip setuptools six install: pip install black flake8 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) 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") diff --git a/requirements.txt b/requirements.txt index b070ffdf611d..5f28ab733f21 100644 --- a/requirements.txt +++ b/requirements.txt @@ -2,19 +2,19 @@ beautifulsoup4 black fake_useragent flake8 -keras +keras; python_version <= '3.8' lxml matplotlib mypy numpy opencv-python -pandas +pandas; python_version <= '3.8' pillow pytest pytest-cov requests -scikit-fuzzy -sklearn +scikit-fuzzy; python_version <= '3.8' +sklearn; python_version <= '3.8' sympy -tensorflow -xgboost +tensorflow; python_version <= '3.8' +xgboost; python_version <= '3.8'