From 3954da8e24ee7e957eba101a8fe1803c605a5752 Mon Sep 17 00:00:00 2001 From: Christopher Samiullah Date: Mon, 20 Feb 2023 10:26:33 +0800 Subject: [PATCH 01/22] switch to railway from heroku for section 06 - 08 (#857) * switch to railway for section 06-08 --- .circleci/config.yml | 57 ++++++++++--------- .../house-prices-api/runtime.txt | 1 - .../house-prices-api/runtime.txt | 1 - .../model-package/regression_model/VERSION | 2 +- .../model-package/tox.ini | 7 ++- section-08-deploying-with-containers/Makefile | 13 ----- .../house-prices-api/requirements.txt | 2 +- .../house-prices-api/runtime.txt | 1 - 8 files changed, 37 insertions(+), 47 deletions(-) delete mode 100644 section-06-model-serving-api/house-prices-api/runtime.txt delete mode 100644 section-07-ci-and-publishing/house-prices-api/runtime.txt delete mode 100644 section-08-deploying-with-containers/Makefile delete mode 100644 section-08-deploying-with-containers/house-prices-api/runtime.txt diff --git a/.circleci/config.yml b/.circleci/config.yml index c916f3f47..037645ab2 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,4 +1,6 @@ -version: 2 +version: '2.1' +orbs: + node: circleci/node@5.1.0 defaults: &defaults docker: @@ -40,15 +42,19 @@ jobs: command: | tox - section_07_deploy_app_to_heroku: + section_07_deploy_app_to_railway: <<: *defaults steps: - checkout: - path: ~/project + path: ~/project/ + - node/install: + node-version: '16.13' + - run: node --version + - run: npm i -g @railway/cli - run: - name: Deploy to Heroku + name: Deploy to Railway App (You must set RAILWAY_TOKEN env var) command: | - git subtree push --prefix section-07-ci-and-publishing/house-prices-api https://heroku:$HEROKU_API_KEY@git.heroku.com/$HEROKU_APP_NAME.git master + cd section-07-ci-and-publishing/house-prices-api && railway up --detach section_07_test_and_upload_regression_model: <<: *defaults @@ -71,28 +77,22 @@ jobs: tox -e publish_model - section_08_deploy_app_container_in_heroku: + section_08_deploy_app_container_via_railway: <<: *defaults steps: - setup_remote_docker: # Supported versions: https://circleci.com/docs/2.0/building-docker-images/#docker-version - version: 20.10.6 + version: 20.10.18 - checkout: - path: ~/project - - run: - name: Build image - command: | - sudo curl https://cli-assets.heroku.com/install.sh | sh - cd section-08-deploying-with-containers && make build-ml-api-heroku - - run: - name: Push Image to Heroku - command: | - # Push the built container to the Heroku image registry - cd section-08-deploying-with-containers && make push-ml-api-heroku + path: ~/project/ + - node/install: + node-version: '16.13' + - run: node --version + - run: npm i -g @railway/cli - run: - name: Release to Heroku + name: Build and run Dockerfile (see https://docs.railway.app/deploy/dockerfiles) command: | - cd section-08-deploying-with-containers && make release-heroku + cd section-08-deploying-with-containers && railway up --detach test_regression_model_py37: docker: @@ -265,24 +265,27 @@ tags_only: &tags_only workflows: version: 2 - section_07: + deploy_pipeline: jobs: - section_07_test_app - - section_07_deploy_app_to_heroku: + - section_07_deploy_app_to_railway: requires: - section_07_test_app filters: branches: only: - master + - demo # upload after git tags are created - section_07_test_and_upload_regression_model: <<: *tags_only - - section_08_deploy_app_container_in_heroku: - filters: - branches: - only: - - master + + - section_08_deploy_app_container_via_railway: + filters: + branches: + only: + - master + - demo # test-all: # jobs: diff --git a/section-06-model-serving-api/house-prices-api/runtime.txt b/section-06-model-serving-api/house-prices-api/runtime.txt deleted file mode 100644 index cd6f13073..000000000 --- a/section-06-model-serving-api/house-prices-api/runtime.txt +++ /dev/null @@ -1 +0,0 @@ -python-3.11.1 \ No newline at end of file diff --git a/section-07-ci-and-publishing/house-prices-api/runtime.txt b/section-07-ci-and-publishing/house-prices-api/runtime.txt deleted file mode 100644 index 88f4ef204..000000000 --- a/section-07-ci-and-publishing/house-prices-api/runtime.txt +++ /dev/null @@ -1 +0,0 @@ -python-3.9.5 \ No newline at end of file diff --git a/section-07-ci-and-publishing/model-package/regression_model/VERSION b/section-07-ci-and-publishing/model-package/regression_model/VERSION index c4e41f945..7636e7565 100644 --- a/section-07-ci-and-publishing/model-package/regression_model/VERSION +++ b/section-07-ci-and-publishing/model-package/regression_model/VERSION @@ -1 +1 @@ -4.0.3 +4.0.5 diff --git a/section-07-ci-and-publishing/model-package/tox.ini b/section-07-ci-and-publishing/model-package/tox.ini index e500db2c8..7a49ed86c 100644 --- a/section-07-ci-and-publishing/model-package/tox.ini +++ b/section-07-ci-and-publishing/model-package/tox.ini @@ -15,7 +15,7 @@ skipsdist = True [testenv] basepython = python install_command = pip install {opts} {packages} -whitelist_externals = train +whitelist_externals = train,python passenv = KAGGLE_USERNAME @@ -23,6 +23,7 @@ passenv = GEMFURY_PUSH_URL [testenv:test_package] +whitelist_externals = python deps = -rrequirements/test_requirements.txt @@ -50,8 +51,9 @@ commands= [testenv:fetch_data] envdir = {toxworkdir}/test_package +whitelist_externals = unzip deps = - {[testenv:test_package]deps} + kaggle<1.6.0 setenv = {[testenv:test_package]setenv} @@ -65,6 +67,7 @@ commands= [testenv:publish_model] envdir = {toxworkdir}/test_package +whitelist_externals = python deps = {[testenv:test_package]deps} diff --git a/section-08-deploying-with-containers/Makefile b/section-08-deploying-with-containers/Makefile deleted file mode 100644 index 9644e8311..000000000 --- a/section-08-deploying-with-containers/Makefile +++ /dev/null @@ -1,13 +0,0 @@ -heroku-login: - HEROKU_API_KEY=${HEROKU_API_KEY} heroku container:login - -build-ml-api-heroku: heroku-login - docker build --build-arg PIP_EXTRA_INDEX_URL=${PIP_EXTRA_INDEX_URL} -t registry.heroku.com/${HEROKU_APP_NAME}/web . - -push-ml-api-heroku: heroku-login - docker push registry.heroku.com/${HEROKU_APP_NAME}/web - -release-heroku: heroku-login - heroku container:release web --app ${HEROKU_APP_NAME} - -.PHONY: heroku-login build-ml-api-heroku push-ml-api-heroku \ No newline at end of file diff --git a/section-08-deploying-with-containers/house-prices-api/requirements.txt b/section-08-deploying-with-containers/house-prices-api/requirements.txt index 602e2c36f..e13438d36 100644 --- a/section-08-deploying-with-containers/house-prices-api/requirements.txt +++ b/section-08-deploying-with-containers/house-prices-api/requirements.txt @@ -7,4 +7,4 @@ pydantic>=1.10.4,<1.12.0 typing_extensions>=4.2.0,<5.0.0 loguru>=0.5.3,<1.0.0 # fetched from gemfury -tid-regression-model==4.0.2 \ No newline at end of file +tid-regression-model==4.0.5 \ No newline at end of file diff --git a/section-08-deploying-with-containers/house-prices-api/runtime.txt b/section-08-deploying-with-containers/house-prices-api/runtime.txt deleted file mode 100644 index 88f4ef204..000000000 --- a/section-08-deploying-with-containers/house-prices-api/runtime.txt +++ /dev/null @@ -1 +0,0 @@ -python-3.9.5 \ No newline at end of file From ebe1e26a9e35ae70626776904e1dbd3505a4bba9 Mon Sep 17 00:00:00 2001 From: Christopher Samiullah Date: Mon, 20 Feb 2023 20:02:37 +0800 Subject: [PATCH 02/22] update tox syntax for v4 (#861) --- section-05-production-model-package/tox.ini | 2 +- section-07-ci-and-publishing/model-package/tox.ini | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/section-05-production-model-package/tox.ini b/section-05-production-model-package/tox.ini index b69b6c7a5..352679afa 100644 --- a/section-05-production-model-package/tox.ini +++ b/section-05-production-model-package/tox.ini @@ -15,7 +15,7 @@ skipsdist = True [testenv] basepython = python install_command = pip install {opts} {packages} -whitelist_externals = train +allowlist_externals = train setenv = PYTHONPATH=. diff --git a/section-07-ci-and-publishing/model-package/tox.ini b/section-07-ci-and-publishing/model-package/tox.ini index 7a49ed86c..59e2500eb 100644 --- a/section-07-ci-and-publishing/model-package/tox.ini +++ b/section-07-ci-and-publishing/model-package/tox.ini @@ -15,7 +15,7 @@ skipsdist = True [testenv] basepython = python install_command = pip install {opts} {packages} -whitelist_externals = train,python +allowlist_externals = train,python passenv = KAGGLE_USERNAME @@ -23,7 +23,7 @@ passenv = GEMFURY_PUSH_URL [testenv:test_package] -whitelist_externals = python +allowlist_externals = python deps = -rrequirements/test_requirements.txt @@ -51,7 +51,7 @@ commands= [testenv:fetch_data] envdir = {toxworkdir}/test_package -whitelist_externals = unzip +allowlist_externals = unzip deps = kaggle<1.6.0 From 0ae1fb2182fcefc470b25daded3e9e28afa12e02 Mon Sep 17 00:00:00 2001 From: Christopher Samiullah Date: Tue, 21 Feb 2023 16:15:11 +0800 Subject: [PATCH 03/22] tox publish fix (#862) --- .../regression_model/pipeline.py | 6 +----- section-05-production-model-package/tox.ini | 1 - section-07-ci-and-publishing/model-package/tox.ini | 2 +- 3 files changed, 2 insertions(+), 7 deletions(-) diff --git a/section-05-production-model-package/regression_model/pipeline.py b/section-05-production-model-package/regression_model/pipeline.py index e6153a6b8..6fc888e01 100644 --- a/section-05-production-model-package/regression_model/pipeline.py +++ b/section-05-production-model-package/regression_model/pipeline.py @@ -1,9 +1,5 @@ from feature_engine.encoding import OrdinalEncoder, RareLabelEncoder -from feature_engine.imputation import ( - AddMissingIndicator, - CategoricalImputer, - MeanMedianImputer, -) +from feature_engine.imputation import AddMissingIndicator, CategoricalImputer, MeanMedianImputer from feature_engine.selection import DropFeatures from feature_engine.transformation import LogTransformer from feature_engine.wrappers import SklearnTransformerWrapper diff --git a/section-05-production-model-package/tox.ini b/section-05-production-model-package/tox.ini index 352679afa..ffc4c60c8 100644 --- a/section-05-production-model-package/tox.ini +++ b/section-05-production-model-package/tox.ini @@ -47,7 +47,6 @@ deps = commands = flake8 regression_model tests isort regression_model tests - black regression_model tests {posargs:mypy regression_model} diff --git a/section-07-ci-and-publishing/model-package/tox.ini b/section-07-ci-and-publishing/model-package/tox.ini index 59e2500eb..d93e00636 100644 --- a/section-07-ci-and-publishing/model-package/tox.ini +++ b/section-07-ci-and-publishing/model-package/tox.ini @@ -67,7 +67,7 @@ commands= [testenv:publish_model] envdir = {toxworkdir}/test_package -whitelist_externals = python +allowlist_externals = * deps = {[testenv:test_package]deps} From 9ea1f7aaf3973f67bad9e22ee768c0131afdef2b Mon Sep 17 00:00:00 2001 From: Soledad Galli Date: Wed, 1 Mar 2023 10:07:14 +0100 Subject: [PATCH 04/22] update links (#866) --- .../01-machine-learning-pipeline-data-analysis.ipynb | 4 ++-- ...chine-learning-pipeline-feature-engineering.ipynb | 10 +++++----- ...machine-learning-pipeline-feature-selection.ipynb | 12 ++++++++++-- ...machine-learning-pipeline-scoring-new-data.ipynb} | 0 .../06-feature-engineering-with-open-source.ipynb | 2 +- .../08-final-machine-learning-pipeline.ipynb | 4 ++-- 6 files changed, 20 insertions(+), 12 deletions(-) rename section-04-research-and-development/{05-machine-learning-pPipeline-scoring-new-data.ipynb => 05-machine-learning-pipeline-scoring-new-data.ipynb} (100%) diff --git a/section-04-research-and-development/01-machine-learning-pipeline-data-analysis.ipynb b/section-04-research-and-development/01-machine-learning-pipeline-data-analysis.ipynb index e17ad470b..df3c3c9f1 100644 --- a/section-04-research-and-development/01-machine-learning-pipeline-data-analysis.ipynb +++ b/section-04-research-and-development/01-machine-learning-pipeline-data-analysis.ipynb @@ -4611,8 +4611,8 @@ "source": [ "# Additional Resources\n", "\n", - "- [Feature Engineering for Machine Learning](https://www.udemy.com/course/feature-engineering-for-machine-learning/?referralCode=A855148E05283015CF06) - Online Course\n", - "- [Packt Feature Engineering Cookbook](https://www.packtpub.com/data/python-feature-engineering-cookbook) - Book\n", + "- [Feature Engineering for Machine Learning](https://www.trainindata.com/p/feature-engineering-for-machine-learning) - Online Course\n", + "- [Packt Feature Engineering Cookbook](https://www.amazon.com/Python-Feature-Engineering-Cookbook-transforming-dp-1804611301/dp/1804611301) - Book\n", "- [Predict house price with Feature-engine](https://www.kaggle.com/solegalli/predict-house-price-with-feature-engine) - Kaggle kernel\n", "- [Comprehensive data exploration with Python](https://www.kaggle.com/pmarcelino/comprehensive-data-exploration-with-python) - Kaggle kernel\n", "- [How I made top 0.3% on a Kaggle competition](https://www.kaggle.com/lavanyashukla01/how-i-made-top-0-3-on-a-kaggle-competition) - Kaggle kernel" diff --git a/section-04-research-and-development/02-machine-learning-pipeline-feature-engineering.ipynb b/section-04-research-and-development/02-machine-learning-pipeline-feature-engineering.ipynb index e8154e762..f777a746d 100644 --- a/section-04-research-and-development/02-machine-learning-pipeline-feature-engineering.ipynb +++ b/section-04-research-and-development/02-machine-learning-pipeline-feature-engineering.ipynb @@ -1652,7 +1652,7 @@ "\n", "For the remaining categorical variables, we will group those categories that are present in less than 1% of the observations. That is, all values of categorical variables that are shared by less than 1% of houses, well be replaced by the string \"Rare\".\n", "\n", - "To learn more about how to handle categorical variables visit our course [Feature Engineering for Machine Learning](https://www.udemy.com/course/feature-engineering-for-machine-learning/?referralCode=A855148E05283015CF06) in Udemy." + "To learn more about how to handle categorical variables visit our course [Feature Engineering for Machine Learning](https://www.trainindata.com/p/feature-engineering-for-machine-learning)." ] }, { @@ -1805,7 +1805,7 @@ "\n", "We will do it so that we capture the monotonic relationship between the label and the target.\n", "\n", - "To learn more about how to encode categorical variables visit our course [Feature Engineering for Machine Learning](https://www.udemy.com/course/feature-engineering-for-machine-learning/?referralCode=A855148E05283015CF06) in Udemy." + "To learn more about how to encode categorical variables visit our course [Feature Engineering for Machine Learning](https://www.trainindata.com/p/feature-engineering-for-machine-learning)." ] }, { @@ -3083,9 +3083,9 @@ "\n", "# Additional Resources\n", "\n", - "- [Feature Engineering for Machine Learning](https://www.udemy.com/course/feature-engineering-for-machine-learning/?referralCode=A855148E05283015CF06) - Online Course\n", - "- [Packt Feature Engineering Cookbook](https://www.packtpub.com/data/python-feature-engineering-cookbook) - Book\n", - "- [Feature Engineering for Machine Learning: A comprehensive Overview](https://trainindata.medium.com/feature-engineering-for-machine-learning-a-comprehensive-overview-a7ad04c896f8) - Article\n", + "- [Feature Engineering for Machine Learning](https://www.trainindata.com/p/feature-engineering-for-machine-learning) - Online Course\n", + "- [Packt Feature Engineering Cookbook](https://www.amazon.com/Python-Feature-Engineering-Cookbook-transforming-dp-1804611301/dp/1804611301) - Book\n", + "- [Feature Engineering for Machine Learning: A comprehensive Overview](https://www.blog.trainindata.com/feature-engineering-for-machine-learning/) - Article\n", "- [Practical Code Implementations of Feature Engineering for Machine Learning with Python](https://towardsdatascience.com/practical-code-implementations-of-feature-engineering-for-machine-learning-with-python-f13b953d4bcd) - Article" ] }, diff --git a/section-04-research-and-development/03-machine-learning-pipeline-feature-selection.ipynb b/section-04-research-and-development/03-machine-learning-pipeline-feature-selection.ipynb index 6d6ef8d9e..c29935ae2 100644 --- a/section-04-research-and-development/03-machine-learning-pipeline-feature-selection.ipynb +++ b/section-04-research-and-development/03-machine-learning-pipeline-feature-selection.ipynb @@ -937,9 +937,17 @@ "source": [ "# Additional Resources\n", "\n", - "- [Feature Selection for Machine Learning](https://www.udemy.com/course/feature-selection-for-machine-learning/?referralCode=186501DF5D93F48C4F71) - Online Course\n", - "- [Feature Selection for Machine Learning: A comprehensive Overview](https://trainindata.medium.com/feature-selection-for-machine-learning-a-comprehensive-overview-bd571db5dd2d) - Article" + "- [Feature Selection for Machine Learning](https://www.trainindata.com/p/feature-selection-for-machine-learning) - Online Course\n", + "- [Feature Selection in Machine Learning with Python](https://leanpub.com/feature-selection-in-machine-learning/) - Book\n", + "- [Feature Selection for Machine Learning: A comprehensive Overview](https://www.blog.trainindata.com/feature-selection-for-machine-learning/) - Article" ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] } ], "metadata": { diff --git a/section-04-research-and-development/05-machine-learning-pPipeline-scoring-new-data.ipynb b/section-04-research-and-development/05-machine-learning-pipeline-scoring-new-data.ipynb similarity index 100% rename from section-04-research-and-development/05-machine-learning-pPipeline-scoring-new-data.ipynb rename to section-04-research-and-development/05-machine-learning-pipeline-scoring-new-data.ipynb diff --git a/section-04-research-and-development/06-feature-engineering-with-open-source.ipynb b/section-04-research-and-development/06-feature-engineering-with-open-source.ipynb index 8c6435004..2d25751b3 100644 --- a/section-04-research-and-development/06-feature-engineering-with-open-source.ipynb +++ b/section-04-research-and-development/06-feature-engineering-with-open-source.ipynb @@ -2019,7 +2019,7 @@ "\n", "We will do it so that we capture the monotonic relationship between the label and the target.\n", "\n", - "To learn more about how to encode categorical variables visit our course [Feature Engineering for Machine Learning](https://www.udemy.com/course/feature-engineering-for-machine-learning/?referralCode=A855148E05283015CF06) in Udemy." + "To learn more about how to encode categorical variables visit our course [Feature Engineering for Machine Learning](https://www.trainindata.com/p/feature-engineering-for-machine-learning)." ] }, { diff --git a/section-04-research-and-development/08-final-machine-learning-pipeline.ipynb b/section-04-research-and-development/08-final-machine-learning-pipeline.ipynb index aeaad1589..b514e7786 100644 --- a/section-04-research-and-development/08-final-machine-learning-pipeline.ipynb +++ b/section-04-research-and-development/08-final-machine-learning-pipeline.ipynb @@ -1081,7 +1081,7 @@ ], "metadata": { "kernelspec": { - "display_name": "Python 3", + "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, @@ -1095,7 +1095,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.8.5" + "version": "3.10.5" }, "toc": { "base_numbering": 1, From 594bebbc451250d61e0a9b836c0a2ce794426d4f Mon Sep 17 00:00:00 2001 From: Christopher Samiullah Date: Thu, 20 Apr 2023 01:15:38 +0800 Subject: [PATCH 05/22] fix feature engine new version breaking changes by updating requirements.txt version range (#876) --- .../requirements/requirements.txt | 2 +- section-06-model-serving-api/house-prices-api/requirements.txt | 3 ++- section-07-ci-and-publishing/house-prices-api/requirements.txt | 3 ++- .../model-package/requirements/requirements.txt | 2 +- .../house-prices-api/requirements.txt | 3 ++- 5 files changed, 8 insertions(+), 5 deletions(-) diff --git a/section-05-production-model-package/requirements/requirements.txt b/section-05-production-model-package/requirements/requirements.txt index f3783b618..0fbffd3a6 100644 --- a/section-05-production-model-package/requirements/requirements.txt +++ b/section-05-production-model-package/requirements/requirements.txt @@ -7,5 +7,5 @@ pydantic>=1.8.1,<2.0.0 scikit-learn>=1.1.3,<2.0.0 strictyaml>=1.3.2,<2.0.0 ruamel.yaml>=0.16.12,<1.0.0 -feature-engine>=1.0.2,<2.0.0 +feature-engine>=1.0.2,<1.6.0 # breaking change in v1.6.0 joblib>=1.0.1,<2.0.0 \ No newline at end of file diff --git a/section-06-model-serving-api/house-prices-api/requirements.txt b/section-06-model-serving-api/house-prices-api/requirements.txt index 1f0ddccf5..c6f00d968 100644 --- a/section-06-model-serving-api/house-prices-api/requirements.txt +++ b/section-06-model-serving-api/house-prices-api/requirements.txt @@ -5,4 +5,5 @@ pydantic>=1.10.4,<1.12.0 typing_extensions>=4.2.0,<5.0.0 loguru>=0.5.3,<1.0.0 # We will explain this in the course -tid-regression-model>=3.2.0 \ No newline at end of file +tid-regression-model>=3.2.0 +feature-engine>=1.0.2,<1.6.0 # breaking change in v1.6.0 \ No newline at end of file diff --git a/section-07-ci-and-publishing/house-prices-api/requirements.txt b/section-07-ci-and-publishing/house-prices-api/requirements.txt index 1f0ddccf5..c6f00d968 100644 --- a/section-07-ci-and-publishing/house-prices-api/requirements.txt +++ b/section-07-ci-and-publishing/house-prices-api/requirements.txt @@ -5,4 +5,5 @@ pydantic>=1.10.4,<1.12.0 typing_extensions>=4.2.0,<5.0.0 loguru>=0.5.3,<1.0.0 # We will explain this in the course -tid-regression-model>=3.2.0 \ No newline at end of file +tid-regression-model>=3.2.0 +feature-engine>=1.0.2,<1.6.0 # breaking change in v1.6.0 \ No newline at end of file diff --git a/section-07-ci-and-publishing/model-package/requirements/requirements.txt b/section-07-ci-and-publishing/model-package/requirements/requirements.txt index f3783b618..0fbffd3a6 100644 --- a/section-07-ci-and-publishing/model-package/requirements/requirements.txt +++ b/section-07-ci-and-publishing/model-package/requirements/requirements.txt @@ -7,5 +7,5 @@ pydantic>=1.8.1,<2.0.0 scikit-learn>=1.1.3,<2.0.0 strictyaml>=1.3.2,<2.0.0 ruamel.yaml>=0.16.12,<1.0.0 -feature-engine>=1.0.2,<2.0.0 +feature-engine>=1.0.2,<1.6.0 # breaking change in v1.6.0 joblib>=1.0.1,<2.0.0 \ No newline at end of file diff --git a/section-08-deploying-with-containers/house-prices-api/requirements.txt b/section-08-deploying-with-containers/house-prices-api/requirements.txt index e13438d36..152b54020 100644 --- a/section-08-deploying-with-containers/house-prices-api/requirements.txt +++ b/section-08-deploying-with-containers/house-prices-api/requirements.txt @@ -7,4 +7,5 @@ pydantic>=1.10.4,<1.12.0 typing_extensions>=4.2.0,<5.0.0 loguru>=0.5.3,<1.0.0 # fetched from gemfury -tid-regression-model==4.0.5 \ No newline at end of file +tid-regression-model==4.0.5 +feature-engine>=1.0.2,<1.6.0 # breaking change in v1.6.0 \ No newline at end of file From 9fd05cc581a9aaca9de6d313f3d26f4c28cc7625 Mon Sep 17 00:00:00 2001 From: maggiechlon Date: Thu, 29 Jun 2023 11:30:45 +0100 Subject: [PATCH 06/22] upload docker --- .../requirements/requirements.txt | 7 ++++--- .../tests/test_features.py | 2 +- .../tests/test_prediction.py | 5 ++++- section-06-model-serving-api/Dockerfile | 17 +++++++++++++++++ .../house-prices-api/app/config.py | 2 +- 5 files changed, 27 insertions(+), 6 deletions(-) create mode 100644 section-06-model-serving-api/Dockerfile diff --git a/section-05-production-model-package/requirements/requirements.txt b/section-05-production-model-package/requirements/requirements.txt index 0fbffd3a6..3192f621b 100644 --- a/section-05-production-model-package/requirements/requirements.txt +++ b/section-05-production-model-package/requirements/requirements.txt @@ -4,8 +4,9 @@ numpy>=1.21.0,<2.0.0 pandas>=1.3.5,<2.0.0 pydantic>=1.8.1,<2.0.0 -scikit-learn>=1.1.3,<2.0.0 +scikit-learn>=1.0.2,<1.1.0 strictyaml>=1.3.2,<2.0.0 ruamel.yaml>=0.16.12,<1.0.0 -feature-engine>=1.0.2,<1.6.0 # breaking change in v1.6.0 -joblib>=1.0.1,<2.0.0 \ No newline at end of file +feature-engine>=1.0.2,<2.0.0 +joblib>=1.0.1,<2.0.0 +scipy==1.7 \ No newline at end of file diff --git a/section-05-production-model-package/tests/test_features.py b/section-05-production-model-package/tests/test_features.py index f3cd92832..d087f8d7d 100644 --- a/section-05-production-model-package/tests/test_features.py +++ b/section-05-production-model-package/tests/test_features.py @@ -9,7 +9,7 @@ def test_temporal_variable_transformer(sample_input_data): reference_variable=config.model_config.ref_var, ) assert sample_input_data["YearRemodAdd"].iat[0] == 1961 - + print(sample_input_data) # When subject = transformer.fit_transform(sample_input_data) diff --git a/section-05-production-model-package/tests/test_prediction.py b/section-05-production-model-package/tests/test_prediction.py index afbc508d0..27596f982 100644 --- a/section-05-production-model-package/tests/test_prediction.py +++ b/section-05-production-model-package/tests/test_prediction.py @@ -2,9 +2,12 @@ import numpy as np -from regression_model.predict import make_prediction +from regression_model.config.core import config +from regression_model.processing.data_manager import load_dataset +from regression_model.predict import make_prediction +sample_input_data=load_dataset(file_name=config.app_config.test_data_file) def test_make_prediction(sample_input_data): # Given expected_first_prediction_value = 113422 diff --git a/section-06-model-serving-api/Dockerfile b/section-06-model-serving-api/Dockerfile new file mode 100644 index 000000000..dbc1b3f75 --- /dev/null +++ b/section-06-model-serving-api/Dockerfile @@ -0,0 +1,17 @@ +# +FROM python:3.9 + +# +WORKDIR /code + +# +COPY ./requirements.txt /code/requirements.txt + +# +RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt + +# +COPY ./app /code/app + +# +CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "80"] diff --git a/section-06-model-serving-api/house-prices-api/app/config.py b/section-06-model-serving-api/house-prices-api/app/config.py index 9dc62e5fb..ca6e7b3c9 100644 --- a/section-06-model-serving-api/house-prices-api/app/config.py +++ b/section-06-model-serving-api/house-prices-api/app/config.py @@ -26,7 +26,7 @@ class Settings(BaseSettings): "https://localhost:8000", # type: ignore ] - PROJECT_NAME: str = "House Price Prediction API" + PROJECT_NAME: str = "house-prices-api" class Config: case_sensitive = True From e412c787e2ebd70640667b947ccca853031ea0f5 Mon Sep 17 00:00:00 2001 From: maggiechlon Date: Thu, 29 Jun 2023 11:33:29 +0100 Subject: [PATCH 07/22] upload docker --- section-06-model-serving-api/Dockerfile | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/section-06-model-serving-api/Dockerfile b/section-06-model-serving-api/Dockerfile index dbc1b3f75..583f4a5f0 100644 --- a/section-06-model-serving-api/Dockerfile +++ b/section-06-model-serving-api/Dockerfile @@ -2,16 +2,16 @@ FROM python:3.9 # -WORKDIR /code +WORKDIR /house-prices-api # -COPY ./requirements.txt /code/requirements.txt +COPY ./app/requirements.txt /house-prices-api/requirements.txt # -RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt +RUN pip install --no-cache-dir --upgrade -r /house-prices-api/requirements.txt # -COPY ./app /code/app +COPY ./app /house-prices-api/app # CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "80"] From 4996c4932340498284609d46367f57a35109d14f Mon Sep 17 00:00:00 2001 From: maggiechlon Date: Thu, 29 Jun 2023 11:34:24 +0100 Subject: [PATCH 08/22] upload docker --- section-06-model-serving-api/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/section-06-model-serving-api/Dockerfile b/section-06-model-serving-api/Dockerfile index 583f4a5f0..696fd25e7 100644 --- a/section-06-model-serving-api/Dockerfile +++ b/section-06-model-serving-api/Dockerfile @@ -5,7 +5,7 @@ FROM python:3.9 WORKDIR /house-prices-api # -COPY ./app/requirements.txt /house-prices-api/requirements.txt +COPY ./requirements.txt /house-prices-api/requirements.txt # RUN pip install --no-cache-dir --upgrade -r /house-prices-api/requirements.txt From fb809e799204921f23709a25915784cc01694f97 Mon Sep 17 00:00:00 2001 From: maggiechlon Date: Thu, 29 Jun 2023 11:37:24 +0100 Subject: [PATCH 09/22] upload docker --- section-06-model-serving-api/Dockerfile | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/section-06-model-serving-api/Dockerfile b/section-06-model-serving-api/Dockerfile index 696fd25e7..ea3a6d086 100644 --- a/section-06-model-serving-api/Dockerfile +++ b/section-06-model-serving-api/Dockerfile @@ -2,16 +2,16 @@ FROM python:3.9 # -WORKDIR /house-prices-api +WORKDIR /section-06-model-serving-api # -COPY ./requirements.txt /house-prices-api/requirements.txt +COPY ./house-prices-api/requirements.txt /section-06-model-serving-api/requirements.txt # -RUN pip install --no-cache-dir --upgrade -r /house-prices-api/requirements.txt +RUN pip install --no-cache-dir --upgrade -r /section-06-model-serving-api/requirements.txt # -COPY ./app /house-prices-api/app +COPY ./app /section-06-model-serving-api/app # CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "80"] From 23465e41d97ca25d480030a5e62fb3d99ab33992 Mon Sep 17 00:00:00 2001 From: maggiechlon Date: Thu, 29 Jun 2023 11:41:08 +0100 Subject: [PATCH 10/22] upload docker --- section-06-model-serving-api/Dockerfile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/section-06-model-serving-api/Dockerfile b/section-06-model-serving-api/Dockerfile index ea3a6d086..54203ee4b 100644 --- a/section-06-model-serving-api/Dockerfile +++ b/section-06-model-serving-api/Dockerfile @@ -8,10 +8,10 @@ WORKDIR /section-06-model-serving-api COPY ./house-prices-api/requirements.txt /section-06-model-serving-api/requirements.txt # -RUN pip install --no-cache-dir --upgrade -r /section-06-model-serving-api/requirements.txt +#RUN pip install --no-cache-dir --upgrade -r /section-06-model-serving-api/requirements.txt # -COPY ./app /section-06-model-serving-api/app +#COPY ./app /section-06-model-serving-api/app # -CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "80"] +#CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "80"] From 158667efd8f16bd45d66f86e653d1092981f1465 Mon Sep 17 00:00:00 2001 From: maggiechlon Date: Thu, 29 Jun 2023 11:44:14 +0100 Subject: [PATCH 11/22] upload docker --- section-06-model-serving-api/Dockerfile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/section-06-model-serving-api/Dockerfile b/section-06-model-serving-api/Dockerfile index 54203ee4b..3d6da6e3c 100644 --- a/section-06-model-serving-api/Dockerfile +++ b/section-06-model-serving-api/Dockerfile @@ -8,10 +8,10 @@ WORKDIR /section-06-model-serving-api COPY ./house-prices-api/requirements.txt /section-06-model-serving-api/requirements.txt # -#RUN pip install --no-cache-dir --upgrade -r /section-06-model-serving-api/requirements.txt +RUN pip install --no-cache-dir --upgrade -r /section-06-model-serving-api/requirements.txt # -#COPY ./app /section-06-model-serving-api/app +COPY ./house-prices-api/app /section-06-model-serving-api/app # -#CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "80"] +CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "80"] From fa4f3c4599cca2415c8f0385dab335fbb7b33e63 Mon Sep 17 00:00:00 2001 From: maggiechlon Date: Thu, 29 Jun 2023 11:50:59 +0100 Subject: [PATCH 12/22] upload docker --- section-06-model-serving-api/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/section-06-model-serving-api/Dockerfile b/section-06-model-serving-api/Dockerfile index 3d6da6e3c..2ef0f4be2 100644 --- a/section-06-model-serving-api/Dockerfile +++ b/section-06-model-serving-api/Dockerfile @@ -14,4 +14,4 @@ RUN pip install --no-cache-dir --upgrade -r /section-06-model-serving-api/requir COPY ./house-prices-api/app /section-06-model-serving-api/app # -CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "80"] +CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8001"] From fe7ba8d9038ab6b406376f093df7837491bf93c0 Mon Sep 17 00:00:00 2001 From: maggiechlon Date: Thu, 29 Jun 2023 12:06:40 +0100 Subject: [PATCH 13/22] upload docker --- section-06-model-serving-api/Dockerfile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/section-06-model-serving-api/Dockerfile b/section-06-model-serving-api/Dockerfile index 2ef0f4be2..ad647333c 100644 --- a/section-06-model-serving-api/Dockerfile +++ b/section-06-model-serving-api/Dockerfile @@ -15,3 +15,5 @@ COPY ./house-prices-api/app /section-06-model-serving-api/app # CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8001"] + +EXPOSE 8001/tcp From caafa90c35c8d9a69df922b9293bab51814fee2a Mon Sep 17 00:00:00 2001 From: maggiechlon Date: Thu, 29 Jun 2023 12:07:22 +0100 Subject: [PATCH 14/22] upload docker --- section-06-model-serving-api/Dockerfile | 1 + 1 file changed, 1 insertion(+) diff --git a/section-06-model-serving-api/Dockerfile b/section-06-model-serving-api/Dockerfile index ad647333c..354ebb351 100644 --- a/section-06-model-serving-api/Dockerfile +++ b/section-06-model-serving-api/Dockerfile @@ -16,4 +16,5 @@ COPY ./house-prices-api/app /section-06-model-serving-api/app # CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8001"] +# EXPOSE 8001/tcp From 195c904f1af31a7a4f45d3c1757bfb3835846b4c Mon Sep 17 00:00:00 2001 From: maggiechlon Date: Thu, 29 Jun 2023 13:20:45 +0100 Subject: [PATCH 15/22] update readme --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 7fbf80b75..cd72d71d6 100644 --- a/README.md +++ b/README.md @@ -2,3 +2,5 @@ Accompanying repo for the online course Deployment of Machine Learning Models. For the documentation, visit the [course on Udemy](https://www.udemy.com/deployment-of-machine-learning-models/?couponCode=TIDREPO). + +an update \ No newline at end of file From cc633f226a0f2b6142d71d01111b891a10394ee0 Mon Sep 17 00:00:00 2001 From: mchlon93 Date: Thu, 29 Jun 2023 13:40:18 +0100 Subject: [PATCH 16/22] update readme --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index cd72d71d6..37e13d5a4 100644 --- a/README.md +++ b/README.md @@ -3,4 +3,4 @@ Accompanying repo for the online course Deployment of Machine Learning Models. For the documentation, visit the [course on Udemy](https://www.udemy.com/deployment-of-machine-learning-models/?couponCode=TIDREPO). -an update \ No newline at end of file +an update why for \ No newline at end of file From 6fa626ec124c9094d97cddd0401c90858196ed74 Mon Sep 17 00:00:00 2001 From: mchlon93 Date: Thu, 29 Jun 2023 13:58:06 +0100 Subject: [PATCH 17/22] bump api version --- section-07-ci-and-publishing/house-prices-api/app/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/section-07-ci-and-publishing/house-prices-api/app/__init__.py b/section-07-ci-and-publishing/house-prices-api/app/__init__.py index 3b93d0be0..b1a19e323 100644 --- a/section-07-ci-and-publishing/house-prices-api/app/__init__.py +++ b/section-07-ci-and-publishing/house-prices-api/app/__init__.py @@ -1 +1 @@ -__version__ = "0.0.2" +__version__ = "0.0.5" From ded0afa172937d93d59b5a294ef111c7200d55ba Mon Sep 17 00:00:00 2001 From: mchlon93 Date: Thu, 29 Jun 2023 16:00:04 +0100 Subject: [PATCH 18/22] update requirements --- .../model-package/requirements/requirements.txt | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/section-07-ci-and-publishing/model-package/requirements/requirements.txt b/section-07-ci-and-publishing/model-package/requirements/requirements.txt index 0fbffd3a6..3192f621b 100644 --- a/section-07-ci-and-publishing/model-package/requirements/requirements.txt +++ b/section-07-ci-and-publishing/model-package/requirements/requirements.txt @@ -4,8 +4,9 @@ numpy>=1.21.0,<2.0.0 pandas>=1.3.5,<2.0.0 pydantic>=1.8.1,<2.0.0 -scikit-learn>=1.1.3,<2.0.0 +scikit-learn>=1.0.2,<1.1.0 strictyaml>=1.3.2,<2.0.0 ruamel.yaml>=0.16.12,<1.0.0 -feature-engine>=1.0.2,<1.6.0 # breaking change in v1.6.0 -joblib>=1.0.1,<2.0.0 \ No newline at end of file +feature-engine>=1.0.2,<2.0.0 +joblib>=1.0.1,<2.0.0 +scipy==1.7 \ No newline at end of file From 1f1af23d1fd1f494a83b65882fc1be7c6f9f19d6 Mon Sep 17 00:00:00 2001 From: mchlon93 Date: Thu, 29 Jun 2023 16:20:45 +0100 Subject: [PATCH 19/22] change order --- .circleci/config.yml | 31 +++++++++++++++++-------------- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 037645ab2..bd2ce8192 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -42,20 +42,6 @@ jobs: command: | tox - section_07_deploy_app_to_railway: - <<: *defaults - steps: - - checkout: - path: ~/project/ - - node/install: - node-version: '16.13' - - run: node --version - - run: npm i -g @railway/cli - - run: - name: Deploy to Railway App (You must set RAILWAY_TOKEN env var) - command: | - cd section-07-ci-and-publishing/house-prices-api && railway up --detach - section_07_test_and_upload_regression_model: <<: *defaults working_directory: ~/project/section-07-ci-and-publishing/model-package @@ -77,6 +63,23 @@ jobs: tox -e publish_model + section_07_deploy_app_to_railway: + <<: *defaults + steps: + - checkout: + path: ~/project/ + - node/install: + node-version: '16.13' + - run: node --version + - run: npm i -g @railway/cli + - run: + name: Deploy to Railway App (You must set RAILWAY_TOKEN env var) + command: | + cd section-07-ci-and-publishing/house-prices-api && railway up --detach + + + + section_08_deploy_app_container_via_railway: <<: *defaults steps: From 5ace8a7fcef729e33bf9f3032a7b02855c57eb66 Mon Sep 17 00:00:00 2001 From: mchlon93 Date: Thu, 29 Jun 2023 16:35:52 +0100 Subject: [PATCH 20/22] Add .circleci/config.yml --- .circleci/config.yml | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index bd2ce8192..6489de5d4 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -63,21 +63,7 @@ jobs: tox -e publish_model - section_07_deploy_app_to_railway: - <<: *defaults - steps: - - checkout: - path: ~/project/ - - node/install: - node-version: '16.13' - - run: node --version - - run: npm i -g @railway/cli - - run: - name: Deploy to Railway App (You must set RAILWAY_TOKEN env var) - command: | - cd section-07-ci-and-publishing/house-prices-api && railway up --detach - - + section_08_deploy_app_container_via_railway: From 46c8c7607bf063ca7bfad3f5034b70d151fe4ec5 Mon Sep 17 00:00:00 2001 From: mchlon93 Date: Thu, 29 Jun 2023 16:36:02 +0100 Subject: [PATCH 21/22] Updated config.yml --- .circleci/config.yml | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index bd2ce8192..6489de5d4 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -63,21 +63,7 @@ jobs: tox -e publish_model - section_07_deploy_app_to_railway: - <<: *defaults - steps: - - checkout: - path: ~/project/ - - node/install: - node-version: '16.13' - - run: node --version - - run: npm i -g @railway/cli - - run: - name: Deploy to Railway App (You must set RAILWAY_TOKEN env var) - command: | - cd section-07-ci-and-publishing/house-prices-api && railway up --detach - - + section_08_deploy_app_container_via_railway: From 049f410548d8856b3d04cb4577639dbebcaadf2d Mon Sep 17 00:00:00 2001 From: mchlon93 Date: Thu, 29 Jun 2023 16:41:41 +0100 Subject: [PATCH 22/22] khara --- .circleci/config.yml | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index bd2ce8192..d94fb8ee4 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -63,21 +63,6 @@ jobs: tox -e publish_model - section_07_deploy_app_to_railway: - <<: *defaults - steps: - - checkout: - path: ~/project/ - - node/install: - node-version: '16.13' - - run: node --version - - run: npm i -g @railway/cli - - run: - name: Deploy to Railway App (You must set RAILWAY_TOKEN env var) - command: | - cd section-07-ci-and-publishing/house-prices-api && railway up --detach - - section_08_deploy_app_container_via_railway: