diff --git a/advanced_tutorials/air_quality/1_air_quality_feature_backfill.ipynb b/advanced_tutorials/air_quality/1_air_quality_feature_backfill.ipynb index 5ad876f9..4af9d1c6 100644 --- a/advanced_tutorials/air_quality/1_air_quality_feature_backfill.ipynb +++ b/advanced_tutorials/air_quality/1_air_quality_feature_backfill.ipynb @@ -49,7 +49,7 @@ } ], "source": [ - "!pip install -U hopsworks --quiet\n", + "!pip install -U 'hopsworks[python]' --quiet\n", "!pip install geopy folium streamlit-folium --q" ] }, @@ -1145,7 +1145,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.8.18" + "version": "3.11.11" } }, "nbformat": 4, diff --git a/advanced_tutorials/air_quality/2_air_quality_feature_pipeline.ipynb b/advanced_tutorials/air_quality/2_air_quality_feature_pipeline.ipynb index 0d67018a..f7d6be2f 100644 --- a/advanced_tutorials/air_quality/2_air_quality_feature_pipeline.ipynb +++ b/advanced_tutorials/air_quality/2_air_quality_feature_pipeline.ipynb @@ -1235,7 +1235,7 @@ ], "metadata": { "kernelspec": { - "display_name": "Python 3", + "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, @@ -1249,7 +1249,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.10.11" + "version": "3.11.11" }, "vscode": { "interpreter": { diff --git a/advanced_tutorials/aml/1_aml_feature_pipeline.ipynb b/advanced_tutorials/aml/1_aml_feature_pipeline.ipynb index 3f08c093..9302b34d 100644 --- a/advanced_tutorials/aml/1_aml_feature_pipeline.ipynb +++ b/advanced_tutorials/aml/1_aml_feature_pipeline.ipynb @@ -22,6 +22,16 @@ "First of all we will load the data and do some feature engineering on it." ] }, + { + "cell_type": "code", + "execution_count": null, + "id": "49d24791-2df7-4b2e-993c-ca02c642fb6f", + "metadata": {}, + "outputs": [], + "source": [ + "!pip install -U 'hopsworks[python]' --quiet" + ] + }, { "cell_type": "markdown", "id": "6a080c46", @@ -693,7 +703,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.10.13" + "version": "3.11.11" } }, "nbformat": 4, diff --git a/advanced_tutorials/bitcoin/1_bitcoin_feature_backfill.ipynb b/advanced_tutorials/bitcoin/1_bitcoin_feature_backfill.ipynb index f405c2b9..094af1e6 100644 --- a/advanced_tutorials/bitcoin/1_bitcoin_feature_backfill.ipynb +++ b/advanced_tutorials/bitcoin/1_bitcoin_feature_backfill.ipynb @@ -40,7 +40,7 @@ "metadata": {}, "outputs": [], "source": [ - "!pip install -U hopsworks --quiet\n", + "!pip install -U 'hopsworks[python]' --quiet\n", "\n", "!pip install -U unicorn-binance-rest-api --quiet\n", "!pip install -U python-dotenv --quiet\n", @@ -414,7 +414,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.9.18" + "version": "3.11.11" } }, "nbformat": 4, diff --git a/advanced_tutorials/bitcoin/2_bitcoin_feature_pipeline.ipynb b/advanced_tutorials/bitcoin/2_bitcoin_feature_pipeline.ipynb index ec6778f2..e85ec568 100644 --- a/advanced_tutorials/bitcoin/2_bitcoin_feature_pipeline.ipynb +++ b/advanced_tutorials/bitcoin/2_bitcoin_feature_pipeline.ipynb @@ -30,7 +30,7 @@ "metadata": {}, "outputs": [], "source": [ - "!pip install -U hopsworks --quiet\n", + "!pip install -U 'hopsworks[python]' --quiet\n", "\n", "!pip install -U unicorn-binance-rest-api --quiet\n", "!pip install -U python-dotenv --quiet\n", @@ -536,7 +536,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.9.18" + "version": "3.11.11" } }, "nbformat": 4, diff --git a/advanced_tutorials/bitcoin/3_bitcoin_training_pipeline.ipynb b/advanced_tutorials/bitcoin/3_bitcoin_training_pipeline.ipynb index f858baaa..0c0773e3 100644 --- a/advanced_tutorials/bitcoin/3_bitcoin_training_pipeline.ipynb +++ b/advanced_tutorials/bitcoin/3_bitcoin_training_pipeline.ipynb @@ -39,7 +39,7 @@ "metadata": {}, "outputs": [], "source": [ - "!pip install -U hopsworks --quiet" + "!pip install -U 'hopsworks[python]' --quiet" ] }, { @@ -996,7 +996,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.12.5" + "version": "3.11.11" }, "vscode": { "interpreter": { diff --git a/advanced_tutorials/bitcoin/4_bitcoin_batch_inference.ipynb b/advanced_tutorials/bitcoin/4_bitcoin_batch_inference.ipynb index 09e00adc..e90de060 100644 --- a/advanced_tutorials/bitcoin/4_bitcoin_batch_inference.ipynb +++ b/advanced_tutorials/bitcoin/4_bitcoin_batch_inference.ipynb @@ -16,6 +16,16 @@ "3. Batch prediction using deployment." ] }, + { + "cell_type": "code", + "execution_count": null, + "id": "bc0e9321-c79f-4ddf-b8f8-783652e2d7a0", + "metadata": {}, + "outputs": [], + "source": [ + "!pip install -U 'hopsworks[python]' --quiet" + ] + }, { "cell_type": "markdown", "id": "8855ee1a", @@ -314,7 +324,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.9.12" + "version": "3.11.11" } }, "nbformat": 4, diff --git a/advanced_tutorials/citibike/1_citibike_feature_backfill.ipynb b/advanced_tutorials/citibike/1_citibike_feature_backfill.ipynb index 8dafddbb..51632caa 100644 --- a/advanced_tutorials/citibike/1_citibike_feature_backfill.ipynb +++ b/advanced_tutorials/citibike/1_citibike_feature_backfill.ipynb @@ -38,7 +38,7 @@ "metadata": {}, "outputs": [], "source": [ - "!pip install -U hopsworks --quiet\n", + "!pip install -U 'hopsworks[python]' --quiet\n", "!pip install python-dotenv" ] }, @@ -620,7 +620,7 @@ "provenance": [] }, "kernelspec": { - "display_name": "Python 3", + "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, @@ -634,7 +634,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.10.11" + "version": "3.11.11" } }, "nbformat": 4, diff --git a/advanced_tutorials/credit_scores/1_credit_scores_feature_backfill.ipynb b/advanced_tutorials/credit_scores/1_credit_scores_feature_backfill.ipynb index f3935a84..73c7c517 100644 --- a/advanced_tutorials/credit_scores/1_credit_scores_feature_backfill.ipynb +++ b/advanced_tutorials/credit_scores/1_credit_scores_feature_backfill.ipynb @@ -33,7 +33,7 @@ "metadata": {}, "outputs": [], "source": [ - "!pip install -U hopsworks --quiet" + "!pip install -U 'hopsworks[python]' --quiet" ] }, { @@ -873,7 +873,7 @@ ], "metadata": { "kernelspec": { - "display_name": "Python 3", + "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, @@ -887,7 +887,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.10.11" + "version": "3.11.11" } }, "nbformat": 4, diff --git a/advanced_tutorials/electricity/1_electricity_feature_backfill.ipynb b/advanced_tutorials/electricity/1_electricity_feature_backfill.ipynb index 098a88bc..c0caaf55 100644 --- a/advanced_tutorials/electricity/1_electricity_feature_backfill.ipynb +++ b/advanced_tutorials/electricity/1_electricity_feature_backfill.ipynb @@ -38,7 +38,7 @@ "metadata": {}, "outputs": [], "source": [ - "!pip install -U hopsworks --quiet" + "!pip install -U 'hopsworks[python]' --quiet" ] }, { @@ -373,7 +373,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.9.18" + "version": "3.11.11" } }, "nbformat": 4, diff --git a/advanced_tutorials/fraud_cheque_detection/requirements.txt b/advanced_tutorials/fraud_cheque_detection/requirements.txt index f79912b0..1bdee34a 100644 --- a/advanced_tutorials/fraud_cheque_detection/requirements.txt +++ b/advanced_tutorials/fraud_cheque_detection/requirements.txt @@ -8,3 +8,4 @@ word2number==1.1 bitsandbytes==0.42.0 accelerate==0.27.2 langchain==0.1.16 +hopsworks[python] diff --git a/advanced_tutorials/hospital_wait_time/1_feature_pipeline.ipynb b/advanced_tutorials/hospital_wait_time/1_feature_pipeline.ipynb index ebf89dff..38f67e02 100644 --- a/advanced_tutorials/hospital_wait_time/1_feature_pipeline.ipynb +++ b/advanced_tutorials/hospital_wait_time/1_feature_pipeline.ipynb @@ -8,6 +8,16 @@ "## 📝 Imports " ] }, + { + "cell_type": "code", + "execution_count": null, + "id": "1b04190c-ffca-4a5b-b93c-3b03cdedd17a", + "metadata": {}, + "outputs": [], + "source": [ + "!pip install -U 'hopsworks[python]' --quiet" + ] + }, { "cell_type": "code", "execution_count": null, @@ -575,7 +585,7 @@ ], "metadata": { "kernelspec": { - "display_name": "Python 3", + "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, @@ -589,7 +599,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.1.-1" + "version": "3.11.11" } }, "nbformat": 4, diff --git a/advanced_tutorials/llm_pdfs/requirements.txt b/advanced_tutorials/llm_pdfs/requirements.txt index 8c00f616..e4f8dd4f 100644 --- a/advanced_tutorials/llm_pdfs/requirements.txt +++ b/advanced_tutorials/llm_pdfs/requirements.txt @@ -19,4 +19,4 @@ openai==1.9.0 getpass4==0.0.14.1 json_repair==0.6.1 protobuf==3.20.0 -hopsworks +hopsworks[python] diff --git a/advanced_tutorials/nyc_taxi_fares/1_nyc_taxi_fares_feature_backfill.ipynb b/advanced_tutorials/nyc_taxi_fares/1_nyc_taxi_fares_feature_backfill.ipynb index 78de0b35..91e02162 100644 --- a/advanced_tutorials/nyc_taxi_fares/1_nyc_taxi_fares_feature_backfill.ipynb +++ b/advanced_tutorials/nyc_taxi_fares/1_nyc_taxi_fares_feature_backfill.ipynb @@ -32,7 +32,7 @@ "metadata": {}, "outputs": [], "source": [ - "!pip install -U hopsworks --quiet" + "!pip install -U 'hopsworks[python]' --quiet" ] }, { @@ -224,7 +224,7 @@ ], "metadata": { "kernelspec": { - "display_name": "Python 3", + "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, @@ -238,7 +238,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.10.11" + "version": "3.11.11" } }, "nbformat": 4, diff --git a/advanced_tutorials/on_demand_feature/notebooks/1_backfill_h_feature_groups.ipynb b/advanced_tutorials/on_demand_feature/notebooks/1_backfill_h_feature_groups.ipynb index 124766ff..c7b6a126 100644 --- a/advanced_tutorials/on_demand_feature/notebooks/1_backfill_h_feature_groups.ipynb +++ b/advanced_tutorials/on_demand_feature/notebooks/1_backfill_h_feature_groups.ipynb @@ -20,7 +20,7 @@ "metadata": {}, "outputs": [], "source": [ - "!pip install -U hopsworks --quiet\n", + "!pip install -U 'hopsworks[python]' --quiet\n", "!pip install -U 'git+https://github.com/logicalclocks/hopsworks-tutorials@master#egg=on_demand_feature&subdirectory=advanced_tutorials/on_demand_feature/on_demand_feature'" ] }, @@ -129,7 +129,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.8.16" + "version": "3.11.11" } }, "nbformat": 4, diff --git a/advanced_tutorials/on_demand_feature/notebooks/2_feature_pipeline.ipynb b/advanced_tutorials/on_demand_feature/notebooks/2_feature_pipeline.ipynb index 2b52894b..7ddd6bfe 100644 --- a/advanced_tutorials/on_demand_feature/notebooks/2_feature_pipeline.ipynb +++ b/advanced_tutorials/on_demand_feature/notebooks/2_feature_pipeline.ipynb @@ -20,7 +20,7 @@ "metadata": {}, "outputs": [], "source": [ - "!pip install -U hopsworks --quiet\n", + "!pip install -U 'hopsworks[python]' --quiet\n", "!pip install -U 'git+https://github.com/logicalclocks/hopsworks-tutorials@master#egg=on_demand_feature&subdirectory=advanced_tutorials/on_demand_feature/on_demand_feature'" ] }, @@ -139,7 +139,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.8.16" + "version": "3.11.11" } }, "nbformat": 4, diff --git a/advanced_tutorials/on_demand_feature/notebooks/3_feature_view_td_modelling.ipynb b/advanced_tutorials/on_demand_feature/notebooks/3_feature_view_td_modelling.ipynb index 37fb952c..5ede1d0b 100644 --- a/advanced_tutorials/on_demand_feature/notebooks/3_feature_view_td_modelling.ipynb +++ b/advanced_tutorials/on_demand_feature/notebooks/3_feature_view_td_modelling.ipynb @@ -14,6 +14,15 @@ "[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/logicalclocks/hopsworks-tutorials/blob/master/advanced_tutorials/on_demand_feature/notebooks/3_feature_view_td_modelling.ipynb)" ] }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "!pip install -U 'hopsworks[python]' --quiet" + ] + }, { "cell_type": "code", "execution_count": null, @@ -358,7 +367,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.8.16" + "version": "3.11.11" } }, "nbformat": 4, diff --git a/advanced_tutorials/recommender-system/requirements.txt b/advanced_tutorials/recommender-system/requirements.txt index 53888762..dfae0e5b 100644 --- a/advanced_tutorials/recommender-system/requirements.txt +++ b/advanced_tutorials/recommender-system/requirements.txt @@ -3,5 +3,5 @@ tensorflow==2.13 tensorflow-recommenders-0.7.2 catboost==1.1.1 opensearch-py==1.1.0 -hopsworks streamlit==1.28.2 +hopsworks[python] diff --git a/advanced_tutorials/tiktok_recsys/python/requirements.txt b/advanced_tutorials/tiktok_recsys/python/requirements.txt index 4ebca888..7ba6d73a 100644 --- a/advanced_tutorials/tiktok_recsys/python/requirements.txt +++ b/advanced_tutorials/tiktok_recsys/python/requirements.txt @@ -2,5 +2,5 @@ mimesis==15.1.0 tensorflow==2.13 tensorflow-recommenders==0.7.2 catboost==1.1.1 -hopsworks==3.7.6 mimesis==15.1.0 +hopsworks[python] diff --git a/advanced_tutorials/timeseries/1_feature_backfill.ipynb b/advanced_tutorials/timeseries/1_feature_backfill.ipynb index 69c273a2..a049117d 100644 --- a/advanced_tutorials/timeseries/1_feature_backfill.ipynb +++ b/advanced_tutorials/timeseries/1_feature_backfill.ipynb @@ -8,6 +8,16 @@ "## 📝 Imports " ] }, + { + "cell_type": "code", + "execution_count": null, + "id": "c84411ee-d103-4458-8ff9-50bb782b4a9a", + "metadata": {}, + "outputs": [], + "source": [ + "!pip install -U 'hopsworks[python]' --quiet" + ] + }, { "cell_type": "code", "execution_count": null, @@ -418,7 +428,7 @@ ], "metadata": { "kernelspec": { - "display_name": "Python 3", + "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, @@ -432,7 +442,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.10.11" + "version": "3.11.11" } }, "nbformat": 4, diff --git a/advanced_tutorials/transformation_functions/custom/1_feature_pipeline.ipynb b/advanced_tutorials/transformation_functions/custom/1_feature_pipeline.ipynb index 7e3b536e..5d904177 100644 --- a/advanced_tutorials/transformation_functions/custom/1_feature_pipeline.ipynb +++ b/advanced_tutorials/transformation_functions/custom/1_feature_pipeline.ipynb @@ -40,7 +40,7 @@ "metadata": {}, "outputs": [], "source": [ - "!pip install -U hopsworks --quiet" + "!pip install -U 'hopsworks[python]' --quiet" ] }, { @@ -508,7 +508,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.12.5" + "version": "3.11.11" } }, "nbformat": 4, diff --git a/advanced_tutorials/transformation_functions/keras/keras_transformation_functions.ipynb b/advanced_tutorials/transformation_functions/keras/keras_transformation_functions.ipynb index 8ec32f72..32318053 100644 --- a/advanced_tutorials/transformation_functions/keras/keras_transformation_functions.ipynb +++ b/advanced_tutorials/transformation_functions/keras/keras_transformation_functions.ipynb @@ -42,6 +42,16 @@ "## 📝 Imports " ] }, + { + "cell_type": "code", + "execution_count": null, + "id": "f6003ca2-21d2-4d45-b185-6995642ed341", + "metadata": {}, + "outputs": [], + "source": [ + "!pip install -U 'hopsworks[python]' --quiet" + ] + }, { "cell_type": "code", "execution_count": null, @@ -1078,7 +1088,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.12.5" + "version": "3.11.11" } }, "nbformat": 4, diff --git a/advanced_tutorials/transformation_functions/pytorch/pytorch_transformation_functions.ipynb b/advanced_tutorials/transformation_functions/pytorch/pytorch_transformation_functions.ipynb index f7dec167..0712ce49 100644 --- a/advanced_tutorials/transformation_functions/pytorch/pytorch_transformation_functions.ipynb +++ b/advanced_tutorials/transformation_functions/pytorch/pytorch_transformation_functions.ipynb @@ -42,6 +42,16 @@ "## 📝 Imports " ] }, + { + "cell_type": "code", + "execution_count": null, + "id": "e716f5a0-8823-4d01-87aa-e927804fe6a9", + "metadata": {}, + "outputs": [], + "source": [ + "!pip install -U 'hopsworks[python]' --quiet" + ] + }, { "cell_type": "code", "execution_count": null, @@ -1158,7 +1168,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.12.5" + "version": "3.11.11" } }, "nbformat": 4, diff --git a/advanced_tutorials/transformation_functions/sklearn/sklearn_transformation_functions.ipynb b/advanced_tutorials/transformation_functions/sklearn/sklearn_transformation_functions.ipynb index f2160d71..f350999f 100644 --- a/advanced_tutorials/transformation_functions/sklearn/sklearn_transformation_functions.ipynb +++ b/advanced_tutorials/transformation_functions/sklearn/sklearn_transformation_functions.ipynb @@ -41,6 +41,16 @@ "## 📝 Imports " ] }, + { + "cell_type": "code", + "execution_count": null, + "id": "f9641905-8dc3-41cd-9840-a893b0d418bc", + "metadata": {}, + "outputs": [], + "source": [ + "!pip install -U 'hopsworks[python]' --quiet" + ] + }, { "cell_type": "code", "execution_count": null, @@ -890,7 +900,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.9.18" + "version": "3.11.11" } }, "nbformat": 4, diff --git a/churn/1_churn_feature_pipeline.ipynb b/churn/1_churn_feature_pipeline.ipynb index 5427f97f..750a287a 100644 --- a/churn/1_churn_feature_pipeline.ipynb +++ b/churn/1_churn_feature_pipeline.ipynb @@ -53,7 +53,7 @@ "metadata": {}, "outputs": [], "source": [ - "!pip install -U hopsworks --quiet" + "!pip install -U 'hopsworks[python]' --quiet" ] }, { @@ -376,7 +376,7 @@ "hash": "31f2aee4e71d21fbe5cf8b01ff0e069b9275f58929596ceb00d14d90e3e16cd6" }, "kernelspec": { - "display_name": "Python 3", + "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, @@ -390,7 +390,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.10.11" + "version": "3.11.11" } }, "nbformat": 4, diff --git a/churn/2_churn_training_pipeline.ipynb b/churn/2_churn_training_pipeline.ipynb index 37461599..a1840b0b 100644 --- a/churn/2_churn_training_pipeline.ipynb +++ b/churn/2_churn_training_pipeline.ipynb @@ -31,7 +31,7 @@ "metadata": {}, "outputs": [], "source": [ - "!pip install -U hopsworks --quiet" + "!pip install -U 'hopsworks[python]' --quiet" ] }, { @@ -458,7 +458,7 @@ "hash": "31f2aee4e71d21fbe5cf8b01ff0e069b9275f58929596ceb00d14d90e3e16cd6" }, "kernelspec": { - "display_name": "Python 3", + "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, @@ -472,7 +472,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.10.11" + "version": "3.11.11" } }, "nbformat": 4, diff --git a/churn/3_churn_batch_inference.ipynb b/churn/3_churn_batch_inference.ipynb index a87b743a..d58c895b 100644 --- a/churn/3_churn_batch_inference.ipynb +++ b/churn/3_churn_batch_inference.ipynb @@ -25,7 +25,7 @@ "metadata": {}, "outputs": [], "source": [ - "!pip install -U hopsworks --quiet" + "!pip install -U 'hopsworks[python]' --quiet" ] }, { @@ -555,7 +555,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.12.5" + "version": "3.11.11" } }, "nbformat": 4, diff --git a/fraud_batch/1_fraud_batch_feature_pipeline.ipynb b/fraud_batch/1_fraud_batch_feature_pipeline.ipynb index 0e731f67..6c003635 100644 --- a/fraud_batch/1_fraud_batch_feature_pipeline.ipynb +++ b/fraud_batch/1_fraud_batch_feature_pipeline.ipynb @@ -40,7 +40,7 @@ "metadata": {}, "outputs": [], "source": [ - "!pip install -U hopsworks --quiet" + "!pip install -U 'hopsworks[python]' --quiet" ] }, { @@ -569,7 +569,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.10.13" + "version": "3.11.11" } }, "nbformat": 4, diff --git a/fraud_online/1_fraud_online_feature_pipeline.ipynb b/fraud_online/1_fraud_online_feature_pipeline.ipynb index 0201475e..1182b31a 100644 --- a/fraud_online/1_fraud_online_feature_pipeline.ipynb +++ b/fraud_online/1_fraud_online_feature_pipeline.ipynb @@ -40,7 +40,7 @@ "metadata": {}, "outputs": [], "source": [ - "!pip install -U hopsworks --quiet" + "!pip install -U 'hopsworks[python]' --quiet" ] }, { @@ -566,7 +566,7 @@ "hash": "e1ddeae6eefc765c17da80d38ea59b893ab18c0c0904077a035ef84cfe367f83" }, "kernelspec": { - "display_name": "Python 3", + "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, @@ -580,7 +580,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.10.11" + "version": "3.11.11" } }, "nbformat": 4, diff --git a/iris/iris_tutorial.ipynb b/iris/iris_tutorial.ipynb index d88cb18c..94dfe3c4 100644 --- a/iris/iris_tutorial.ipynb +++ b/iris/iris_tutorial.ipynb @@ -42,7 +42,7 @@ "metadata": {}, "outputs": [], "source": [ - "!pip install -U hopsworks --quiet\n", + "!pip install -U 'hopsworks[python]' --quiet\n", "!pip install -U xgboost --quiet" ] }, @@ -822,7 +822,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.9.19" + "version": "3.11.11" }, "vscode": { "interpreter": { diff --git a/loan_approval/0-loan-approval-eda.ipynb b/loan_approval/0-loan-approval-eda.ipynb index da5ac116..5938da15 100644 --- a/loan_approval/0-loan-approval-eda.ipynb +++ b/loan_approval/0-loan-approval-eda.ipynb @@ -220,12 +220,6 @@ "metadata": { "_kg_hide-input": true, "_kg_hide-output": true, - "execution": { - "iopub.execute_input": "2023-01-31T14:11:23.066230Z", - "iopub.status.busy": "2023-01-31T14:11:23.065356Z", - "iopub.status.idle": "2023-01-31T14:11:35.106519Z", - "shell.execute_reply": "2023-01-31T14:11:35.105319Z" - }, "papermill": { "duration": 12.072611, "end_time": "2023-01-31T14:11:35.109296", @@ -246,12 +240,6 @@ "id": "9cb24c87", "metadata": { "_kg_hide-input": true, - "execution": { - "iopub.execute_input": "2023-01-31T14:11:35.164738Z", - "iopub.status.busy": "2023-01-31T14:11:35.163899Z", - "iopub.status.idle": "2023-01-31T14:11:44.332161Z", - "shell.execute_reply": "2023-01-31T14:11:44.331116Z" - }, "papermill": { "duration": 9.198485, "end_time": "2023-01-31T14:11:44.334641", @@ -332,12 +320,6 @@ "execution_count": null, "id": "d0def3d9", "metadata": { - "execution": { - "iopub.execute_input": "2023-01-31T14:11:48.208667Z", - "iopub.status.busy": "2023-01-31T14:11:48.208157Z", - "iopub.status.idle": "2023-01-31T14:11:48.428818Z", - "shell.execute_reply": "2023-01-31T14:11:48.427863Z" - }, "papermill": { "duration": 0.360858, "end_time": "2023-01-31T14:11:48.431029", @@ -397,12 +379,6 @@ "id": "d0b744fe", "metadata": { "_kg_hide-input": true, - "execution": { - "iopub.execute_input": "2023-01-31T14:11:49.732975Z", - "iopub.status.busy": "2023-01-31T14:11:49.732602Z", - "iopub.status.idle": "2023-01-31T14:11:49.876013Z", - "shell.execute_reply": "2023-01-31T14:11:49.874915Z" - }, "papermill": { "duration": 0.288595, "end_time": "2023-01-31T14:11:49.878903", @@ -425,12 +401,6 @@ "execution_count": null, "id": "fc93cc0a", "metadata": { - "execution": { - "iopub.execute_input": "2023-01-31T14:11:50.144334Z", - "iopub.status.busy": "2023-01-31T14:11:50.143658Z", - "iopub.status.idle": "2023-01-31T14:11:51.482919Z", - "shell.execute_reply": "2023-01-31T14:11:51.482016Z" - }, "papermill": { "duration": 1.475483, "end_time": "2023-01-31T14:11:51.485527", @@ -497,12 +467,6 @@ "id": "f91dc121", "metadata": { "_kg_hide-input": true, - "execution": { - "iopub.execute_input": "2023-01-31T14:11:52.380732Z", - "iopub.status.busy": "2023-01-31T14:11:52.380348Z", - "iopub.status.idle": "2023-01-31T14:11:54.597468Z", - "shell.execute_reply": "2023-01-31T14:11:54.596538Z" - }, "papermill": { "duration": 2.35527, "end_time": "2023-01-31T14:11:54.599563", @@ -537,12 +501,6 @@ "id": "040fad6d", "metadata": { "_kg_hide-input": true, - "execution": { - "iopub.execute_input": "2023-01-31T14:11:54.883832Z", - "iopub.status.busy": "2023-01-31T14:11:54.883390Z", - "iopub.status.idle": "2023-01-31T14:11:59.307951Z", - "shell.execute_reply": "2023-01-31T14:11:59.307102Z" - }, "papermill": { "duration": 4.577688, "end_time": "2023-01-31T14:11:59.314551", @@ -572,12 +530,6 @@ "execution_count": null, "id": "53c70ace", "metadata": { - "execution": { - "iopub.execute_input": "2023-01-31T14:11:59.602251Z", - "iopub.status.busy": "2023-01-31T14:11:59.601879Z", - "iopub.status.idle": "2023-01-31T14:11:59.684007Z", - "shell.execute_reply": "2023-01-31T14:11:59.682910Z" - }, "papermill": { "duration": 0.229165, "end_time": "2023-01-31T14:11:59.687448", @@ -621,12 +573,6 @@ "execution_count": null, "id": "70aa69ed", "metadata": { - "execution": { - "iopub.execute_input": "2023-01-31T14:12:00.270988Z", - "iopub.status.busy": "2023-01-31T14:12:00.270581Z", - "iopub.status.idle": "2023-01-31T14:12:00.321055Z", - "shell.execute_reply": "2023-01-31T14:12:00.319526Z" - }, "papermill": { "duration": 0.198063, "end_time": "2023-01-31T14:12:00.323272", @@ -648,12 +594,6 @@ "id": "ae92e2ea", "metadata": { "_kg_hide-input": true, - "execution": { - "iopub.execute_input": "2023-01-31T14:12:00.912199Z", - "iopub.status.busy": "2023-01-31T14:12:00.911251Z", - "iopub.status.idle": "2023-01-31T14:12:01.182365Z", - "shell.execute_reply": "2023-01-31T14:12:01.181421Z" - }, "papermill": { "duration": 0.418881, "end_time": "2023-01-31T14:12:01.184591", @@ -680,12 +620,6 @@ "id": "e214d20d", "metadata": { "_kg_hide-input": true, - "execution": { - "iopub.execute_input": "2023-01-31T14:12:01.472342Z", - "iopub.status.busy": "2023-01-31T14:12:01.471980Z", - "iopub.status.idle": "2023-01-31T14:12:01.748800Z", - "shell.execute_reply": "2023-01-31T14:12:01.747850Z" - }, "papermill": { "duration": 0.423688, "end_time": "2023-01-31T14:12:01.750966", @@ -711,12 +645,6 @@ "execution_count": null, "id": "40e6d01b", "metadata": { - "execution": { - "iopub.execute_input": "2023-01-31T14:12:02.042393Z", - "iopub.status.busy": "2023-01-31T14:12:02.041837Z", - "iopub.status.idle": "2023-01-31T14:12:02.046222Z", - "shell.execute_reply": "2023-01-31T14:12:02.045324Z" - }, "papermill": { "duration": 0.151329, "end_time": "2023-01-31T14:12:02.048171", @@ -736,12 +664,6 @@ "execution_count": null, "id": "cf8013d3", "metadata": { - "execution": { - "iopub.execute_input": "2023-01-31T14:12:02.340509Z", - "iopub.status.busy": "2023-01-31T14:12:02.339615Z", - "iopub.status.idle": "2023-01-31T14:12:03.622301Z", - "shell.execute_reply": "2023-01-31T14:12:03.621351Z" - }, "papermill": { "duration": 1.431306, "end_time": "2023-01-31T14:12:03.624333", @@ -787,12 +709,6 @@ "execution_count": null, "id": "b6b0236c", "metadata": { - "execution": { - "iopub.execute_input": "2023-01-31T14:12:04.214700Z", - "iopub.status.busy": "2023-01-31T14:12:04.213713Z", - "iopub.status.idle": "2023-01-31T14:12:04.675722Z", - "shell.execute_reply": "2023-01-31T14:12:04.674726Z" - }, "papermill": { "duration": 0.614298, "end_time": "2023-01-31T14:12:04.677979", @@ -844,12 +760,6 @@ "execution_count": null, "id": "77eef4d3", "metadata": { - "execution": { - "iopub.execute_input": "2023-01-31T14:12:05.289816Z", - "iopub.status.busy": "2023-01-31T14:12:05.289275Z", - "iopub.status.idle": "2023-01-31T14:12:05.323262Z", - "shell.execute_reply": "2023-01-31T14:12:05.322297Z" - }, "papermill": { "duration": 0.191205, "end_time": "2023-01-31T14:12:05.325324", @@ -870,12 +780,6 @@ "id": "fdef8762", "metadata": { "_kg_hide-input": true, - "execution": { - "iopub.execute_input": "2023-01-31T14:12:05.621553Z", - "iopub.status.busy": "2023-01-31T14:12:05.621180Z", - "iopub.status.idle": "2023-01-31T14:12:06.036487Z", - "shell.execute_reply": "2023-01-31T14:12:06.035534Z" - }, "papermill": { "duration": 0.565012, "end_time": "2023-01-31T14:12:06.038922", @@ -908,12 +812,6 @@ "execution_count": null, "id": "74bf2b1e", "metadata": { - "execution": { - "iopub.execute_input": "2023-01-31T14:12:06.335754Z", - "iopub.status.busy": "2023-01-31T14:12:06.334576Z", - "iopub.status.idle": "2023-01-31T14:12:06.424596Z", - "shell.execute_reply": "2023-01-31T14:12:06.423659Z" - }, "papermill": { "duration": 0.240425, "end_time": "2023-01-31T14:12:06.426982", @@ -935,12 +833,6 @@ "execution_count": null, "id": "b2ed0e02", "metadata": { - "execution": { - "iopub.execute_input": "2023-01-31T14:12:09.290990Z", - "iopub.status.busy": "2023-01-31T14:12:09.290604Z", - "iopub.status.idle": "2023-01-31T14:12:09.320869Z", - "shell.execute_reply": "2023-01-31T14:12:09.319562Z" - }, "papermill": { "duration": 0.177802, "end_time": "2023-01-31T14:12:09.322848", @@ -963,12 +855,6 @@ "execution_count": null, "id": "fca3149d", "metadata": { - "execution": { - "iopub.execute_input": "2023-01-31T14:12:06.721182Z", - "iopub.status.busy": "2023-01-31T14:12:06.720805Z", - "iopub.status.idle": "2023-01-31T14:12:08.973871Z", - "shell.execute_reply": "2023-01-31T14:12:08.971578Z" - }, "papermill": { "duration": 2.402818, "end_time": "2023-01-31T14:12:08.976597", @@ -1022,12 +908,6 @@ "id": "731b9dfc", "metadata": { "_kg_hide-input": true, - "execution": { - "iopub.execute_input": "2023-01-31T14:12:09.909900Z", - "iopub.status.busy": "2023-01-31T14:12:09.909218Z", - "iopub.status.idle": "2023-01-31T14:12:10.857398Z", - "shell.execute_reply": "2023-01-31T14:12:10.856447Z" - }, "papermill": { "duration": 1.099592, "end_time": "2023-01-31T14:12:10.859758", @@ -1060,12 +940,6 @@ "id": "7f7a85b1", "metadata": { "_kg_hide-input": true, - "execution": { - "iopub.execute_input": "2023-01-31T14:12:11.156771Z", - "iopub.status.busy": "2023-01-31T14:12:11.154957Z", - "iopub.status.idle": "2023-01-31T14:12:11.728880Z", - "shell.execute_reply": "2023-01-31T14:12:11.727767Z" - }, "papermill": { "duration": 0.724907, "end_time": "2023-01-31T14:12:11.731917", @@ -1089,12 +963,6 @@ "execution_count": null, "id": "d4725db8", "metadata": { - "execution": { - "iopub.execute_input": "2023-01-31T14:12:12.026158Z", - "iopub.status.busy": "2023-01-31T14:12:12.025788Z", - "iopub.status.idle": "2023-01-31T14:12:12.042068Z", - "shell.execute_reply": "2023-01-31T14:12:12.040486Z" - }, "papermill": { "duration": 0.16509, "end_time": "2023-01-31T14:12:12.044742", @@ -1115,12 +983,6 @@ "execution_count": null, "id": "0f84f5f9", "metadata": { - "execution": { - "iopub.execute_input": "2023-01-31T14:12:12.339696Z", - "iopub.status.busy": "2023-01-31T14:12:12.338723Z", - "iopub.status.idle": "2023-01-31T14:12:12.348232Z", - "shell.execute_reply": "2023-01-31T14:12:12.347259Z" - }, "papermill": { "duration": 0.159654, "end_time": "2023-01-31T14:12:12.350236", @@ -1140,12 +1002,6 @@ "execution_count": null, "id": "4f59ead9", "metadata": { - "execution": { - "iopub.execute_input": "2023-01-31T14:12:12.673034Z", - "iopub.status.busy": "2023-01-31T14:12:12.672678Z", - "iopub.status.idle": "2023-01-31T14:12:12.682802Z", - "shell.execute_reply": "2023-01-31T14:12:12.681815Z" - }, "papermill": { "duration": 0.16214, "end_time": "2023-01-31T14:12:12.684818", @@ -1203,12 +1059,6 @@ "execution_count": null, "id": "75d137a5", "metadata": { - "execution": { - "iopub.execute_input": "2023-01-31T14:12:13.579516Z", - "iopub.status.busy": "2023-01-31T14:12:13.579136Z", - "iopub.status.idle": "2023-01-31T14:12:13.678625Z", - "shell.execute_reply": "2023-01-31T14:12:13.677368Z" - }, "papermill": { "duration": 0.257848, "end_time": "2023-01-31T14:12:13.681808", @@ -1229,12 +1079,6 @@ "execution_count": null, "id": "8047d205", "metadata": { - "execution": { - "iopub.execute_input": "2023-01-31T14:12:13.977982Z", - "iopub.status.busy": "2023-01-31T14:12:13.977614Z", - "iopub.status.idle": "2023-01-31T14:12:14.097881Z", - "shell.execute_reply": "2023-01-31T14:12:14.096753Z" - }, "papermill": { "duration": 0.272453, "end_time": "2023-01-31T14:12:14.100367", @@ -1254,12 +1098,6 @@ "execution_count": null, "id": "5c9ef851", "metadata": { - "execution": { - "iopub.execute_input": "2023-01-31T14:12:14.394715Z", - "iopub.status.busy": "2023-01-31T14:12:14.394186Z", - "iopub.status.idle": "2023-01-31T14:12:15.564326Z", - "shell.execute_reply": "2023-01-31T14:12:15.563368Z" - }, "papermill": { "duration": 1.320229, "end_time": "2023-01-31T14:12:15.566648", @@ -1310,12 +1148,6 @@ "execution_count": null, "id": "2919e5bb", "metadata": { - "execution": { - "iopub.execute_input": "2023-01-31T14:12:16.181958Z", - "iopub.status.busy": "2023-01-31T14:12:16.181367Z", - "iopub.status.idle": "2023-01-31T14:12:16.186151Z", - "shell.execute_reply": "2023-01-31T14:12:16.185231Z" - }, "papermill": { "duration": 0.16354, "end_time": "2023-01-31T14:12:16.188233", @@ -1335,12 +1167,6 @@ "execution_count": null, "id": "3c091a4f", "metadata": { - "execution": { - "iopub.execute_input": "2023-01-31T14:12:16.490844Z", - "iopub.status.busy": "2023-01-31T14:12:16.490455Z", - "iopub.status.idle": "2023-01-31T14:12:16.518947Z", - "shell.execute_reply": "2023-01-31T14:12:16.517888Z" - }, "papermill": { "duration": 0.178713, "end_time": "2023-01-31T14:12:16.521106", @@ -1360,12 +1186,6 @@ "execution_count": null, "id": "095cd7fe", "metadata": { - "execution": { - "iopub.execute_input": "2023-01-31T14:12:16.815316Z", - "iopub.status.busy": "2023-01-31T14:12:16.814929Z", - "iopub.status.idle": "2023-01-31T14:12:17.095807Z", - "shell.execute_reply": "2023-01-31T14:12:17.094774Z" - }, "papermill": { "duration": 0.429455, "end_time": "2023-01-31T14:12:17.098362", @@ -1387,12 +1207,6 @@ "id": "f8fb03b4", "metadata": { "_kg_hide-input": true, - "execution": { - "iopub.execute_input": "2023-01-31T14:12:17.395662Z", - "iopub.status.busy": "2023-01-31T14:12:17.394380Z", - "iopub.status.idle": "2023-01-31T14:12:17.937939Z", - "shell.execute_reply": "2023-01-31T14:12:17.936798Z" - }, "papermill": { "duration": 0.695868, "end_time": "2023-01-31T14:12:17.941389", @@ -1448,12 +1262,6 @@ "execution_count": null, "id": "c2a77108", "metadata": { - "execution": { - "iopub.execute_input": "2023-01-31T14:12:18.541342Z", - "iopub.status.busy": "2023-01-31T14:12:18.540011Z", - "iopub.status.idle": "2023-01-31T14:12:18.560536Z", - "shell.execute_reply": "2023-01-31T14:12:18.559514Z" - }, "papermill": { "duration": 0.174333, "end_time": "2023-01-31T14:12:18.562615", @@ -1473,12 +1281,6 @@ "execution_count": null, "id": "3a66e89b", "metadata": { - "execution": { - "iopub.execute_input": "2023-01-31T14:12:18.863079Z", - "iopub.status.busy": "2023-01-31T14:12:18.862171Z", - "iopub.status.idle": "2023-01-31T14:12:18.972847Z", - "shell.execute_reply": "2023-01-31T14:12:18.971833Z" - }, "papermill": { "duration": 0.265544, "end_time": "2023-01-31T14:12:18.975299", @@ -1498,12 +1300,6 @@ "execution_count": null, "id": "6cec9664", "metadata": { - "execution": { - "iopub.execute_input": "2023-01-31T14:12:19.274772Z", - "iopub.status.busy": "2023-01-31T14:12:19.273735Z", - "iopub.status.idle": "2023-01-31T14:12:19.335061Z", - "shell.execute_reply": "2023-01-31T14:12:19.333961Z" - }, "papermill": { "duration": 0.215234, "end_time": "2023-01-31T14:12:19.337477", @@ -1563,12 +1359,6 @@ "execution_count": null, "id": "42563071", "metadata": { - "execution": { - "iopub.execute_input": "2023-01-31T14:12:20.415337Z", - "iopub.status.busy": "2023-01-31T14:12:20.414777Z", - "iopub.status.idle": "2023-01-31T14:12:20.433852Z", - "shell.execute_reply": "2023-01-31T14:12:20.432871Z" - }, "papermill": { "duration": 0.171636, "end_time": "2023-01-31T14:12:20.435870", @@ -1589,12 +1379,6 @@ "id": "dcc361e8", "metadata": { "_kg_hide-input": true, - "execution": { - "iopub.execute_input": "2023-01-31T14:12:20.739577Z", - "iopub.status.busy": "2023-01-31T14:12:20.739068Z", - "iopub.status.idle": "2023-01-31T14:12:21.306101Z", - "shell.execute_reply": "2023-01-31T14:12:21.304951Z" - }, "papermill": { "duration": 0.725663, "end_time": "2023-01-31T14:12:21.309668", @@ -1624,12 +1408,6 @@ "execution_count": null, "id": "a6317632", "metadata": { - "execution": { - "iopub.execute_input": "2023-01-31T14:12:21.611624Z", - "iopub.status.busy": "2023-01-31T14:12:21.611228Z", - "iopub.status.idle": "2023-01-31T14:12:21.619388Z", - "shell.execute_reply": "2023-01-31T14:12:21.618043Z" - }, "papermill": { "duration": 0.161181, "end_time": "2023-01-31T14:12:21.621421", @@ -1649,12 +1427,6 @@ "execution_count": null, "id": "b36edd1e", "metadata": { - "execution": { - "iopub.execute_input": "2023-01-31T14:12:21.919541Z", - "iopub.status.busy": "2023-01-31T14:12:21.919103Z", - "iopub.status.idle": "2023-01-31T14:12:21.928624Z", - "shell.execute_reply": "2023-01-31T14:12:21.927649Z" - }, "papermill": { "duration": 0.160732, "end_time": "2023-01-31T14:12:21.930639", @@ -1675,12 +1447,6 @@ "id": "b17deaaf", "metadata": { "_kg_hide-input": true, - "execution": { - "iopub.execute_input": "2023-01-31T14:12:22.328472Z", - "iopub.status.busy": "2023-01-31T14:12:22.328059Z", - "iopub.status.idle": "2023-01-31T14:12:24.015459Z", - "shell.execute_reply": "2023-01-31T14:12:24.014555Z" - }, "papermill": { "duration": 1.92155, "end_time": "2023-01-31T14:12:24.017679", @@ -1722,12 +1488,6 @@ "execution_count": null, "id": "5b1b85e9", "metadata": { - "execution": { - "iopub.execute_input": "2023-01-31T14:12:24.318319Z", - "iopub.status.busy": "2023-01-31T14:12:24.317947Z", - "iopub.status.idle": "2023-01-31T14:12:24.325483Z", - "shell.execute_reply": "2023-01-31T14:12:24.324312Z" - }, "papermill": { "duration": 0.161113, "end_time": "2023-01-31T14:12:24.327397", @@ -1748,12 +1508,6 @@ "execution_count": null, "id": "22b06c2f", "metadata": { - "execution": { - "iopub.execute_input": "2023-01-31T14:12:24.629020Z", - "iopub.status.busy": "2023-01-31T14:12:24.628653Z", - "iopub.status.idle": "2023-01-31T14:12:24.636854Z", - "shell.execute_reply": "2023-01-31T14:12:24.635410Z" - }, "papermill": { "duration": 0.161665, "end_time": "2023-01-31T14:12:24.638920", @@ -1774,12 +1528,6 @@ "execution_count": null, "id": "0e198592", "metadata": { - "execution": { - "iopub.execute_input": "2023-01-31T14:12:24.942037Z", - "iopub.status.busy": "2023-01-31T14:12:24.940354Z", - "iopub.status.idle": "2023-01-31T14:12:24.948942Z", - "shell.execute_reply": "2023-01-31T14:12:24.947340Z" - }, "papermill": { "duration": 0.16504, "end_time": "2023-01-31T14:12:24.951622", @@ -1801,12 +1549,6 @@ "id": "22af3f0d", "metadata": { "_kg_hide-input": true, - "execution": { - "iopub.execute_input": "2023-01-31T14:12:25.253891Z", - "iopub.status.busy": "2023-01-31T14:12:25.253350Z", - "iopub.status.idle": "2023-01-31T14:12:26.273380Z", - "shell.execute_reply": "2023-01-31T14:12:26.272426Z" - }, "papermill": { "duration": 1.173001, "end_time": "2023-01-31T14:12:26.275912", @@ -1843,12 +1585,6 @@ "execution_count": null, "id": "a3345a64", "metadata": { - "execution": { - "iopub.execute_input": "2023-01-31T14:12:26.588087Z", - "iopub.status.busy": "2023-01-31T14:12:26.587715Z", - "iopub.status.idle": "2023-01-31T14:12:26.612819Z", - "shell.execute_reply": "2023-01-31T14:12:26.611670Z" - }, "papermill": { "duration": 0.187618, "end_time": "2023-01-31T14:12:26.614831", @@ -1868,12 +1604,6 @@ "execution_count": null, "id": "11826ab0", "metadata": { - "execution": { - "iopub.execute_input": "2023-01-31T14:12:26.930841Z", - "iopub.status.busy": "2023-01-31T14:12:26.929227Z", - "iopub.status.idle": "2023-01-31T14:12:26.938643Z", - "shell.execute_reply": "2023-01-31T14:12:26.937196Z" - }, "papermill": { "duration": 0.170808, "end_time": "2023-01-31T14:12:26.940675", @@ -1895,12 +1625,6 @@ "id": "dc64e1f0", "metadata": { "_kg_hide-input": true, - "execution": { - "iopub.execute_input": "2023-01-31T14:12:27.243124Z", - "iopub.status.busy": "2023-01-31T14:12:27.241672Z", - "iopub.status.idle": "2023-01-31T14:12:28.266333Z", - "shell.execute_reply": "2023-01-31T14:12:28.265235Z" - }, "papermill": { "duration": 1.180146, "end_time": "2023-01-31T14:12:28.269958", @@ -1936,12 +1660,6 @@ "execution_count": null, "id": "8d1e5c62", "metadata": { - "execution": { - "iopub.execute_input": "2023-01-31T14:12:28.580428Z", - "iopub.status.busy": "2023-01-31T14:12:28.579400Z", - "iopub.status.idle": "2023-01-31T14:12:28.589632Z", - "shell.execute_reply": "2023-01-31T14:12:28.588379Z" - }, "papermill": { "duration": 0.171475, "end_time": "2023-01-31T14:12:28.591778", @@ -2004,12 +1722,6 @@ "id": "387d4fe3", "metadata": { "_kg_hide-input": true, - "execution": { - "iopub.execute_input": "2023-01-31T14:12:29.510041Z", - "iopub.status.busy": "2023-01-31T14:12:29.508161Z", - "iopub.status.idle": "2023-01-31T14:12:29.764863Z", - "shell.execute_reply": "2023-01-31T14:12:29.763753Z" - }, "papermill": { "duration": 0.414204, "end_time": "2023-01-31T14:12:29.767964", @@ -2039,12 +1751,6 @@ "id": "9eb8c609", "metadata": { "_kg_hide-input": true, - "execution": { - "iopub.execute_input": "2023-01-31T14:12:30.072638Z", - "iopub.status.busy": "2023-01-31T14:12:30.071706Z", - "iopub.status.idle": "2023-01-31T14:12:30.339683Z", - "shell.execute_reply": "2023-01-31T14:12:30.338576Z" - }, "papermill": { "duration": 0.423536, "end_time": "2023-01-31T14:12:30.342742", @@ -2074,12 +1780,6 @@ "id": "4b2d72a0", "metadata": { "_kg_hide-input": true, - "execution": { - "iopub.execute_input": "2023-01-31T14:12:30.786349Z", - "iopub.status.busy": "2023-01-31T14:12:30.785908Z", - "iopub.status.idle": "2023-01-31T14:12:31.159279Z", - "shell.execute_reply": "2023-01-31T14:12:31.158182Z" - }, "papermill": { "duration": 0.616708, "end_time": "2023-01-31T14:12:31.161961", @@ -2106,12 +1806,6 @@ "id": "d55ed9a9", "metadata": { "_kg_hide-input": true, - "execution": { - "iopub.execute_input": "2023-01-31T14:12:31.469856Z", - "iopub.status.busy": "2023-01-31T14:12:31.469468Z", - "iopub.status.idle": "2023-01-31T14:12:31.717374Z", - "shell.execute_reply": "2023-01-31T14:12:31.716435Z" - }, "papermill": { "duration": 0.406545, "end_time": "2023-01-31T14:12:31.719463", @@ -2140,12 +1834,6 @@ "execution_count": null, "id": "907456ef", "metadata": { - "execution": { - "iopub.execute_input": "2023-01-31T14:12:32.025463Z", - "iopub.status.busy": "2023-01-31T14:12:32.024713Z", - "iopub.status.idle": "2023-01-31T14:12:32.031804Z", - "shell.execute_reply": "2023-01-31T14:12:32.030926Z" - }, "papermill": { "duration": 0.163943, "end_time": "2023-01-31T14:12:32.033818", @@ -2185,12 +1873,6 @@ "execution_count": null, "id": "53a5c4a7", "metadata": { - "execution": { - "iopub.execute_input": "2023-01-31T14:12:32.338934Z", - "iopub.status.busy": "2023-01-31T14:12:32.338562Z", - "iopub.status.idle": "2023-01-31T14:12:32.817616Z", - "shell.execute_reply": "2023-01-31T14:12:32.816627Z" - }, "papermill": { "duration": 0.636201, "end_time": "2023-01-31T14:12:32.820041", @@ -2212,12 +1894,6 @@ "execution_count": null, "id": "9c013fa4", "metadata": { - "execution": { - "iopub.execute_input": "2023-01-31T14:12:33.129127Z", - "iopub.status.busy": "2023-01-31T14:12:33.128752Z", - "iopub.status.idle": "2023-01-31T14:12:34.864630Z", - "shell.execute_reply": "2023-01-31T14:12:34.863535Z" - }, "papermill": { "duration": 1.894658, "end_time": "2023-01-31T14:12:34.867043", @@ -2269,12 +1945,6 @@ "execution_count": null, "id": "e82164d0", "metadata": { - "execution": { - "iopub.execute_input": "2023-01-31T14:12:35.503660Z", - "iopub.status.busy": "2023-01-31T14:12:35.503227Z", - "iopub.status.idle": "2023-01-31T14:12:35.628647Z", - "shell.execute_reply": "2023-01-31T14:12:35.627514Z" - }, "papermill": { "duration": 0.30106, "end_time": "2023-01-31T14:12:35.631447", @@ -2298,12 +1968,6 @@ "id": "a7a9f389", "metadata": { "_kg_hide-input": true, - "execution": { - "iopub.execute_input": "2023-01-31T14:12:35.965873Z", - "iopub.status.busy": "2023-01-31T14:12:35.964950Z", - "iopub.status.idle": "2023-01-31T14:12:36.307578Z", - "shell.execute_reply": "2023-01-31T14:12:36.306477Z" - }, "papermill": { "duration": 0.507635, "end_time": "2023-01-31T14:12:36.310128", @@ -2371,12 +2035,6 @@ "execution_count": null, "id": "3a5120f0", "metadata": { - "execution": { - "iopub.execute_input": "2023-01-31T14:12:38.208077Z", - "iopub.status.busy": "2023-01-31T14:12:38.207044Z", - "iopub.status.idle": "2023-01-31T14:12:38.418885Z", - "shell.execute_reply": "2023-01-31T14:12:38.417592Z" - }, "papermill": { "duration": 0.369849, "end_time": "2023-01-31T14:12:38.421013", @@ -2418,12 +2076,6 @@ "execution_count": null, "id": "31fff0c5", "metadata": { - "execution": { - "iopub.execute_input": "2023-01-31T14:12:39.041691Z", - "iopub.status.busy": "2023-01-31T14:12:39.041315Z", - "iopub.status.idle": "2023-01-31T14:12:39.107185Z", - "shell.execute_reply": "2023-01-31T14:12:39.106047Z" - }, "papermill": { "duration": 0.225569, "end_time": "2023-01-31T14:12:39.109800", @@ -2477,12 +2129,6 @@ "execution_count": null, "id": "d1109872", "metadata": { - "execution": { - "iopub.execute_input": "2023-01-31T14:12:40.511490Z", - "iopub.status.busy": "2023-01-31T14:12:40.511130Z", - "iopub.status.idle": "2023-01-31T14:12:40.536770Z", - "shell.execute_reply": "2023-01-31T14:12:40.535787Z" - }, "papermill": { "duration": 0.18835, "end_time": "2023-01-31T14:12:40.538845", @@ -2502,12 +2148,6 @@ "execution_count": null, "id": "d7555668", "metadata": { - "execution": { - "iopub.execute_input": "2023-01-31T14:12:40.853484Z", - "iopub.status.busy": "2023-01-31T14:12:40.852478Z", - "iopub.status.idle": "2023-01-31T14:12:41.357523Z", - "shell.execute_reply": "2023-01-31T14:12:41.356169Z" - }, "papermill": { "duration": 0.666708, "end_time": "2023-01-31T14:12:41.359726", @@ -2564,12 +2204,6 @@ "execution_count": null, "id": "3b66695f", "metadata": { - "execution": { - "iopub.execute_input": "2023-01-31T14:12:42.936415Z", - "iopub.status.busy": "2023-01-31T14:12:42.936036Z", - "iopub.status.idle": "2023-01-31T14:12:42.986007Z", - "shell.execute_reply": "2023-01-31T14:12:42.984879Z" - }, "papermill": { "duration": 0.207784, "end_time": "2023-01-31T14:12:42.988632", @@ -2589,12 +2223,6 @@ "execution_count": null, "id": "9e41c72a", "metadata": { - "execution": { - "iopub.execute_input": "2023-01-31T14:12:43.299107Z", - "iopub.status.busy": "2023-01-31T14:12:43.298021Z", - "iopub.status.idle": "2023-01-31T14:12:43.325665Z", - "shell.execute_reply": "2023-01-31T14:12:43.324658Z" - }, "papermill": { "duration": 0.184422, "end_time": "2023-01-31T14:12:43.327767", @@ -2652,12 +2280,6 @@ "execution_count": null, "id": "41a0c87b", "metadata": { - "execution": { - "iopub.execute_input": "2023-01-31T14:12:44.655052Z", - "iopub.status.busy": "2023-01-31T14:12:44.653060Z", - "iopub.status.idle": "2023-01-31T14:12:44.667971Z", - "shell.execute_reply": "2023-01-31T14:12:44.666899Z" - }, "papermill": { "duration": 0.175319, "end_time": "2023-01-31T14:12:44.670092", @@ -2677,12 +2299,6 @@ "execution_count": null, "id": "891733d8", "metadata": { - "execution": { - "iopub.execute_input": "2023-01-31T14:12:44.983451Z", - "iopub.status.busy": "2023-01-31T14:12:44.983069Z", - "iopub.status.idle": "2023-01-31T14:12:44.991441Z", - "shell.execute_reply": "2023-01-31T14:12:44.990258Z" - }, "papermill": { "duration": 0.166463, "end_time": "2023-01-31T14:12:44.993460", @@ -2702,12 +2318,6 @@ "execution_count": null, "id": "2bc0905e", "metadata": { - "execution": { - "iopub.execute_input": "2023-01-31T14:12:45.307361Z", - "iopub.status.busy": "2023-01-31T14:12:45.306247Z", - "iopub.status.idle": "2023-01-31T14:12:45.608851Z", - "shell.execute_reply": "2023-01-31T14:12:45.607758Z" - }, "papermill": { "duration": 0.462107, "end_time": "2023-01-31T14:12:45.611758", @@ -2744,12 +2354,6 @@ "execution_count": null, "id": "655aa19d", "metadata": { - "execution": { - "iopub.execute_input": "2023-01-31T14:12:46.237863Z", - "iopub.status.busy": "2023-01-31T14:12:46.237469Z", - "iopub.status.idle": "2023-01-31T14:12:46.332340Z", - "shell.execute_reply": "2023-01-31T14:12:46.331345Z" - }, "papermill": { "duration": 0.253754, "end_time": "2023-01-31T14:12:46.335011", @@ -2769,12 +2373,6 @@ "execution_count": null, "id": "b117359c", "metadata": { - "execution": { - "iopub.execute_input": "2023-01-31T14:12:46.654049Z", - "iopub.status.busy": "2023-01-31T14:12:46.651882Z", - "iopub.status.idle": "2023-01-31T14:12:46.658992Z", - "shell.execute_reply": "2023-01-31T14:12:46.657913Z" - }, "papermill": { "duration": 0.16887, "end_time": "2023-01-31T14:12:46.660980", @@ -2798,12 +2396,6 @@ "execution_count": null, "id": "75bb4c76", "metadata": { - "execution": { - "iopub.execute_input": "2023-01-31T14:12:46.991455Z", - "iopub.status.busy": "2023-01-31T14:12:46.990863Z", - "iopub.status.idle": "2023-01-31T14:12:57.341490Z", - "shell.execute_reply": "2023-01-31T14:12:57.340452Z" - }, "papermill": { "duration": 10.520365, "end_time": "2023-01-31T14:12:57.343915", @@ -2844,12 +2436,6 @@ "execution_count": null, "id": "4752a829", "metadata": { - "execution": { - "iopub.execute_input": "2023-01-31T14:12:57.973866Z", - "iopub.status.busy": "2023-01-31T14:12:57.973485Z", - "iopub.status.idle": "2023-01-31T14:12:58.107244Z", - "shell.execute_reply": "2023-01-31T14:12:58.106190Z" - }, "papermill": { "duration": 0.2977, "end_time": "2023-01-31T14:12:58.109603", @@ -2873,12 +2459,6 @@ "execution_count": null, "id": "157b0699", "metadata": { - "execution": { - "iopub.execute_input": "2023-01-31T14:13:00.218650Z", - "iopub.status.busy": "2023-01-31T14:13:00.217514Z", - "iopub.status.idle": "2023-01-31T14:13:00.247794Z", - "shell.execute_reply": "2023-01-31T14:13:00.246722Z" - }, "papermill": { "duration": 0.189848, "end_time": "2023-01-31T14:13:00.249831", @@ -2898,12 +2478,6 @@ "execution_count": null, "id": "e9b015fc", "metadata": { - "execution": { - "iopub.execute_input": "2023-01-31T14:13:03.111792Z", - "iopub.status.busy": "2023-01-31T14:13:03.111236Z", - "iopub.status.idle": "2023-01-31T14:13:03.119932Z", - "shell.execute_reply": "2023-01-31T14:13:03.118991Z" - }, "papermill": { "duration": 0.177794, "end_time": "2023-01-31T14:13:03.121926", @@ -2929,7 +2503,7 @@ ], "metadata": { "kernelspec": { - "display_name": "Python 3 (ipykernel)", + "display_name": "Python", "language": "python", "name": "python3" }, @@ -2943,7 +2517,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.9.18" + "version": "3.10.11" }, "papermill": { "default_parameters": {}, diff --git a/loan_approval/1-loan-approval-feature-pipeline.ipynb b/loan_approval/1-loan-approval-feature-pipeline.ipynb index e17fcacd..031236f2 100644 --- a/loan_approval/1-loan-approval-feature-pipeline.ipynb +++ b/loan_approval/1-loan-approval-feature-pipeline.ipynb @@ -41,7 +41,7 @@ "metadata": {}, "outputs": [], "source": [ - "!pip install --quiet hopsworks " + "!pip install -U 'hopsworks[python]' --quiet" ] }, { @@ -970,14 +970,14 @@ " try:\n", " f = loans_fg.get_feature(name)\n", " loans_fg.update_feature_description(name, metadata['Description'][entry])\n", - " print(\"Updating description of feature: {}\".format(f.name))\n", + " print(\"⛳️ Updating description of feature: {}\".format(f.name))\n", " except:\n", " pass # do nothing\n", "\n", " try:\n", " f = applicants_fg.get_feature(name)\n", " applicants_fg.update_feature_description(name, metadata['Description'][entry])\n", - " print(\"Updating description of feature: {}\".format(f.name))\n", + " print(\"⛳️ Updating description of feature: {}\".format(f.name))\n", " except:\n", " pass # do nothing" ] @@ -997,7 +997,7 @@ ], "metadata": { "kernelspec": { - "display_name": "Python 3", + "display_name": "Python", "language": "python", "name": "python3" }, diff --git a/loan_approval/2-loan-approval-training-pipeline.ipynb b/loan_approval/2-loan-approval-training-pipeline.ipynb index c7d1fa2b..4e0e9c57 100644 --- a/loan_approval/2-loan-approval-training-pipeline.ipynb +++ b/loan_approval/2-loan-approval-training-pipeline.ipynb @@ -43,7 +43,7 @@ "metadata": {}, "outputs": [], "source": [ - "!pip install --quiet hopsworks " + "!pip install -U 'hopsworks[python]' --quiet" ] }, { @@ -154,8 +154,8 @@ "outputs": [], "source": [ "# Select features for training dataset\n", - "selected_features = fg_loans.select_except([\"id\", \"issue_d\"]).join(\\\n", - " fg_applicants.select_except([\"earliest_cr_line\", \"earliest_cr_line_year\", \"id\"]))\n", + "selected_features = fg_loans.select_features().join(\\\n", + " fg_applicants.select_features())\n", "\n", "# Uncomment this if you would like to view your selected features\n", "# selected_features.show(5)" @@ -401,34 +401,13 @@ { "cell_type": "code", "execution_count": null, - "id": "5924aa50", - "metadata": { - "papermill": { - "duration": 2.472623, - "end_time": "2023-01-31T14:32:40.633694", - "exception": false, - "start_time": "2023-01-31T14:32:38.161071", - "status": "completed" - }, - "tags": [] - }, + "id": "c2145452-254a-4aa9-97a0-19e21ecb4396", + "metadata": {}, "outputs": [], "source": [ - "# Create a Confusion Matrix display from the classifier's predictions on the test set\n", - "disp = ConfusionMatrixDisplay.from_estimator(\n", - " clf, # Classifier pipeline\n", - " X_test, # Test set features\n", - " y_test, # True labels for the test set\n", - " cmap='Blues', # Color map for the display\n", - " values_format='d', # Format for the values in the display\n", - " display_labels=['Default', 'Fully-Paid'], # Labels for the display\n", - ")\n", - "\n", - "# Create a ROC Curve display from the classifier's predictions on the test set\n", - "display = RocCurveDisplay.from_estimator(clf, X_test, y_test)\n", - "\n", - "# Plot the ROC Curve\n", - "display.plot()" + "# Calculate and print the ROC AUC score on the test set\n", + "accuracy = roc_auc_score(y_test, clf.predict(X_test))\n", + "print(\"⛳️ ROC AUC Score on Test Set:\", accuracy)" ] }, { @@ -466,53 +445,57 @@ "metadata": {}, "outputs": [], "source": [ - "# Create a directory \"features\" within the \"lending_model\" directory, if it doesn't exist\n", - "os.makedirs(\"lending_model/features\", exist_ok=True)\n", + "# Specify the directory for saving the model\n", + "model_dir = \"lending_model\"\n", "\n", - "# Save the ROC Curve plot as 'roc_curve.png' in the \"lending_model\" directory\n", - "plt.savefig('lending_model/roc_curve.png')\n", + "# Check if the directory exists, and create it if not\n", + "if not os.path.isdir(model_dir):\n", + " os.mkdir(model_dir)\n", "\n", "# Save the trained classifier pipeline as 'lending_model.pkl' in the \"lending_model\" directory\n", - "joblib.dump(clf, 'lending_model/lending_model.pkl')\n", - "\n", - "# Calculate and print the ROC AUC score on the test set\n", - "accuracy = roc_auc_score(y_test, clf.predict(X_test))\n", - "print(\"⛳️ ROC AUC Score on Test Set:\", accuracy)" + "joblib.dump(clf, f'{model_dir}/lending_model.pkl')" ] }, { - "cell_type": "markdown", - "id": "647102d1", + "cell_type": "code", + "execution_count": null, + "id": "bddaaf36-aa11-46ce-b2d3-00e90957a0d7", "metadata": {}, + "outputs": [], "source": [ - "### ⚙️ Model Schema\n", + "# Check if the images directory exists, and create it if not\n", + "images_dir = f\"{model_dir}/images\"\n", + "if not os.path.isdir(images_dir):\n", + " os.mkdir(images_dir)\n", "\n", - "The model needs to be set up with a [Model Schema](https://docs.hopsworks.ai/3.0/user_guides/mlops/registry/model_schema/), which describes the inputs and outputs for a model.\n", - "\n", - "A Model Schema can be automatically generated from training examples, as shown below." + "# Create and save Confusion Matrix\n", + "plt.figure(figsize=(8, 6))\n", + "disp = ConfusionMatrixDisplay.from_estimator(\n", + " clf,\n", + " X_test,\n", + " y_test,\n", + " cmap='Blues',\n", + " values_format='d',\n", + " display_labels=['Default', 'Fully-Paid']\n", + ")\n", + "disp.plot()\n", + "plt.savefig(f'{images_dir}/confusion_matrix.png')\n", + "plt.close()" ] }, { "cell_type": "code", "execution_count": null, - "id": "20d2d6db", + "id": "51f84fac-52ef-49f5-9408-999947519ae5", "metadata": {}, "outputs": [], "source": [ - "from hsml.schema import Schema\n", - "from hsml.model_schema import ModelSchema\n", - "\n", - "# Define an input schema\n", - "input_schema = Schema(X_test)\n", - "\n", - "# Define an output schema\n", - "output_schema = Schema(y_test)\n", - "\n", - "# Define a model schema\n", - "model_schema = ModelSchema(\n", - " input_schema=input_schema, # Specify the input schema\n", - " output_schema=output_schema, # Specify the output schema\n", - ")" + "# Create and save ROC Curve\n", + "plt.figure(figsize=(8, 6))\n", + "display = RocCurveDisplay.from_estimator(clf, X_test, y_test)\n", + "display.plot()\n", + "plt.savefig(f'{images_dir}/roc_curve.png')\n", + "plt.close()" ] }, { @@ -537,11 +520,11 @@ " \"lending_model\",\n", " metrics={'accuracy': accuracy}, # Specify metrics for the model\n", " input_example=X_test.sample().to_numpy(), # Provide an input example for the model\n", - " model_schema=model_schema, # Specify the model schema\n", + " feature_view=feature_view, # Add a feature view to the model\n", ")\n", "\n", - "# Save the created model in the \"lending_model\" directory\n", - "fraud_model.save('lending_model')" + "# Save the created model in the model directory\n", + "fraud_model.save(model_dir)" ] }, { @@ -558,7 +541,7 @@ ], "metadata": { "kernelspec": { - "display_name": "Python 3", + "display_name": "Python", "language": "python", "name": "python3" }, diff --git a/loan_approval/3-loan-approval-batch-inference.ipynb b/loan_approval/3-loan-approval-batch-inference.ipynb index 8ad00268..62c40f68 100644 --- a/loan_approval/3-loan-approval-batch-inference.ipynb +++ b/loan_approval/3-loan-approval-batch-inference.ipynb @@ -30,7 +30,7 @@ "metadata": {}, "outputs": [], "source": [ - "!pip install --quiet hopsworks " + "!pip install -U 'hopsworks[python]' --quiet" ] }, { @@ -71,7 +71,7 @@ "id": "c6ebb07e", "metadata": {}, "source": [ - "## 🔮 Connect to Hopsworks Feature Store" + "## 🔮 Connect to Hopsworks Model Registry" ] }, { @@ -85,76 +85,55 @@ "\n", "project = hopsworks.login()\n", "\n", - "fs = project.get_feature_store()" - ] - }, - { - "cell_type": "markdown", - "id": "c35f50e8", - "metadata": {}, - "source": [ - "## ⚙️ Feature View Retrieval\n" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "fde529ba", - "metadata": {}, - "outputs": [], - "source": [ - "# Get the 'loans_approvals' feature view\n", - "feature_view = fs.get_feature_view(\n", - " name=\"loans_approvals\", \n", - " version=FV_VERSION,\n", - ")" + "# Get the model registry\n", + "mr = project.get_model_registry()" ] }, { "cell_type": "markdown", - "id": "871fb3e6", + "id": "e33a656a", "metadata": {}, "source": [ - "## 🗄 Model Registry\n" + "## 🚀 Fetch the model" ] }, { "cell_type": "code", "execution_count": null, - "id": "629006f7", + "id": "296b3056", "metadata": {}, "outputs": [], "source": [ - "# Get the model registry\n", - "mr = project.get_model_registry()" + "# Retrieve the model from the Model Registry using the name \"lending_model\" and specified version\n", + "retrieved_model = mr.get_model(\n", + " \"lending_model\",\n", + " version=MODEL_VERSION,\n", + ")\n", + "\n", + "# Download the model directory from the Model Registry\n", + "model_dir = retrieved_model.download()\n", + "\n", + "# Load the model using joblib from the downloaded model directory\n", + "model = joblib.load(model_dir + \"/lending_model.pkl\")" ] }, { "cell_type": "markdown", - "id": "e33a656a", + "id": "6301b695-ef7c-4373-aeee-1e27d7a85160", "metadata": {}, "source": [ - "## 🚀 Fetch and test the model" + "## ⚙️ Feature View Retrieval\n" ] }, { "cell_type": "code", "execution_count": null, - "id": "296b3056", + "id": "c74c245b-1429-4733-b141-7d3d7ee115ed", "metadata": {}, "outputs": [], "source": [ - "# Retrieve the model from the Model Registry using the name \"lending_model\" and specified version\n", - "model = mr.get_model(\n", - " \"lending_model\",\n", - " version=MODEL_VERSION,\n", - ")\n", - "\n", - "# Download the model directory from the Model Registry\n", - "model_dir = model.download()\n", - "\n", - "# Load the model using joblib from the downloaded model directory\n", - "model = joblib.load(model_dir + \"/lending_model.pkl\")" + "# Get the feature view\n", + "feature_view = retrieved_model.get_feature_view()" ] }, { @@ -172,9 +151,6 @@ "metadata": {}, "outputs": [], "source": [ - "# Initialize batch scoring\n", - "feature_view.init_batch_scoring(1)\n", - "\n", "# Get batch data for a specified time range from start_time_data to end_time_data\n", "batch_data = feature_view.get_batch_data(\n", " start_time=START_TIME_DATA,\n", @@ -217,7 +193,7 @@ ], "metadata": { "kernelspec": { - "display_name": "Python 3", + "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, @@ -231,7 +207,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.10.11" + "version": "3.11.11" }, "papermill": { "default_parameters": {}, diff --git a/loan_approval/requirements.txt b/loan_approval/requirements.txt index c90fc027..0f63abad 100644 --- a/loan_approval/requirements.txt +++ b/loan_approval/requirements.txt @@ -1,3 +1,3 @@ -hopsworks +hopsworks[python] joblib scikit-learn diff --git a/quickstart.ipynb b/quickstart.ipynb index 71eb58f6..a37c6cf1 100644 --- a/quickstart.ipynb +++ b/quickstart.ipynb @@ -35,7 +35,7 @@ }, "outputs": [], "source": [ - "!pip install -U hopsworks --quiet" + "!pip install -U 'hopsworks[python]' --quiet" ] }, { @@ -69,7 +69,7 @@ "\n", "import pandas as pd\n", "import numpy as np\n", - "from matplotlib import pyplot\n", + "import matplotlib.pyplot as plt\n", "import seaborn as sns\n", "from math import radians\n", "\n", @@ -429,7 +429,7 @@ "outputs": [], "source": [ "# Insert data into feature group\n", - "window_aggs_fg.insert(window_aggs_df)" + "window_aggs_fg.insert(window_aggs_df, wait=True)" ] }, { @@ -478,7 +478,7 @@ "source": [ "# Select features for training data\n", "selected_features = trans_fg.select([\"fraud_label\", \"category\", \"amount\", \"age_at_transaction\", \"days_until_card_expires\", \"loc_delta\"])\\\n", - " .join(window_aggs_fg.select_except([\"cc_num\"]))" + " .join(window_aggs_fg.select_all(include_primary_key=False))" ] }, { @@ -723,27 +723,6 @@ "print(results)" ] }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "# Create a DataFrame for the confusion matrix results\n", - "df_cm = pd.DataFrame(\n", - " results, \n", - " ['True Normal', 'True Fraud'],\n", - " ['Pred Normal', 'Pred Fraud'],\n", - ")\n", - "\n", - "# Create a heatmap using seaborn with annotations\n", - "cm = sns.heatmap(df_cm, annot=True)\n", - "\n", - "# Get the figure and display it\n", - "fig = cm.get_figure()\n", - "fig.show()" - ] - }, { "cell_type": "markdown", "metadata": {}, @@ -753,15 +732,11 @@ }, { "cell_type": "markdown", - "metadata": { - "tags": [] - }, + "metadata": {}, "source": [ - "### ⚙️ Model Schema\n", - "\n", - "The model needs to be set up with a [Model Schema](https://docs.hopsworks.ai/3.0/user_guides/mlops/registry/model_schema/), which describes the inputs and outputs for a model.\n", + "## 📝 Register model\n", "\n", - "A Model Schema can be automatically generated from training examples, as shown below." + "One of the features in Hopsworks is the model registry. This is where we can store different versions of models and compare their performance. Models from the registry can then be served as API endpoints." ] }, { @@ -770,29 +745,15 @@ "metadata": {}, "outputs": [], "source": [ - "from hsml.schema import Schema\n", - "from hsml.model_schema import ModelSchema\n", - "\n", - "# Create a Schema for the input features using the values of X_train\n", - "input_schema = Schema(X_train.values)\n", - "\n", - "# Create a Schema for the output using y_train\n", - "output_schema = Schema(y_train)\n", - "\n", - "# Create a ModelSchema using the defined input and output schemas\n", - "model_schema = ModelSchema(input_schema=input_schema, output_schema=output_schema)\n", + "# Specify the directory name for saving the model and related artifacts\n", + "model_dir = \"quickstart_fraud_model\"\n", "\n", - "# Convert the model schema to a dictionary for inspection\n", - "model_schema.to_dict()" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## 📝 Register model\n", + "# Check if the directory already exists; if not, create it\n", + "if not os.path.isdir(model_dir):\n", + " os.mkdir(model_dir)\n", "\n", - "One of the features in Hopsworks is the model registry. This is where we can store different versions of models and compare their performance. Models from the registry can then be served as API endpoints." + "# Save the trained XGBoost classifier to a joblib file in the specified directory\n", + "joblib.dump(clf, model_dir + '/xgboost_model.pkl')" ] }, { @@ -801,18 +762,36 @@ "metadata": {}, "outputs": [], "source": [ - "# Specify the directory name for saving the model and related artifacts\n", - "model_dir = \"quickstart_fraud_model\"\n", + "# Check if the images directory exists, and create it if not\n", + "images_dir = f\"{model_dir}/images\"\n", + "if not os.path.isdir(images_dir):\n", + " os.mkdir(images_dir)\n", "\n", - "# Check if the directory already exists; if not, create it\n", - "if not os.path.isdir(model_dir):\n", - " os.mkdir(model_dir)\n", + "# Create a DataFrame for the confusion matrix results\n", + "df_cm = pd.DataFrame(\n", + " results, \n", + " ['True Normal', 'True Fraud'],\n", + " ['Pred Normal', 'Pred Fraud'],\n", + ")\n", "\n", - "# Save the trained XGBoost classifier to a joblib file in the specified directory\n", - "joblib.dump(clf, model_dir + '/xgboost_model.pkl')\n", + "# Create figure with specific size\n", + "plt.figure(figsize=(8, 6))\n", + "\n", + "# Create a heatmap using seaborn with annotations\n", + "cm = sns.heatmap(\n", + " df_cm, \n", + " annot=True,\n", + " fmt='d', # Use integer format for annotations\n", + " cmap='Blues', # Use a blue colormap\n", + " cbar=True # Include a color bar\n", + ")\n", "\n", - "# Save the confusion matrix heatmap figure to an image file in the specified directory\n", - "fig.savefig(model_dir + \"/confusion_matrix.png\")" + "# Save the figure\n", + "plt.savefig(f'{images_dir}/confusion_matrix.png', bbox_inches='tight')\n", + "\n", + "# Clear the plot and close the figure\n", + "plt.clf()\n", + "plt.close()" ] }, { @@ -827,9 +806,9 @@ "# Create a Python model named \"fraud\" in the model registry\n", "fraud_model = mr.python.create_model(\n", " name=\"fraud\", \n", - " metrics=metrics, # Specify the metrics used to evaluate the model\n", - " model_schema=model_schema, # Use the previously defined model schema\n", - " input_example=[4700702588013561], # Provide an input example for testing deployments\n", + " metrics=metrics, # Specify the metrics used to evaluate the model\n", + " feature_view=feature_view, # Add a feature view to the model\n", + " input_example=[4700702588013561], # Provide an input example for testing deployments\n", " description=\"Quickstart Fraud Predictor\", # Add a description for the model\n", ")\n", "\n", @@ -882,7 +861,7 @@ "%%writefile predict_example.py\n", "import os\n", "import numpy as np\n", - "import hsfs\n", + "import hopsworks\n", "import joblib\n", "\n", "\n", @@ -891,14 +870,15 @@ " def __init__(self):\n", " \"\"\" Initializes the serving state, reads a trained model\"\"\" \n", " # Get feature store handle\n", - " fs_conn = hsfs.connection()\n", - " self.fs = fs_conn.get_feature_store()\n", - " \n", - " # Get feature view\n", - " self.fv = self.fs.get_feature_view(\"transactions_view\", 1)\n", + " project = hopsworks.login()\n", + " self.mr = project.get_model_registry()\n", " \n", - " # Initialize serving\n", - " self.fv.init_serving(1)\n", + " # Retrieve the feature view from the model\n", + " retrieved_model = self.mr.get_model(\n", + " name=\"fraud\",\n", + " version=1,\n", + " )\n", + " self.feature_view = retrieved_model.get_feature_view()\n", "\n", " # Load the trained model\n", " self.model = joblib.load(os.environ[\"ARTIFACT_FILES_PATH\"] + \"/xgboost_model.pkl\")\n", @@ -906,7 +886,7 @@ "\n", " def predict(self, inputs):\n", " \"\"\" Serves a prediction request usign a trained model\"\"\"\n", - " feature_vector = self.fv.get_feature_vector({\"cc_num\": inputs[0][0]})\n", + " feature_vector = self.feature_view.get_feature_vector({\"cc_num\": inputs[0][0]})\n", " feature_vector = feature_vector[:-2] + feature_vector[-1:]\n", " \n", " return self.model.predict(np.asarray(feature_vector).reshape(1, -1)).tolist() # Numpy Arrays are not JSON serializable" @@ -1134,7 +1114,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.12.5" + "version": "3.11.11" }, "widgets": { "application/vnd.jupyter.widget-state+json": { diff --git a/requirements.txt b/requirements.txt index ff30a46e..3e42e773 100644 --- a/requirements.txt +++ b/requirements.txt @@ -4,17 +4,17 @@ numpy xgboost python-dotenv parsedatetime -hsfs[python] -hopsworks +hopsworks[python] jupyter ipykernel nbconvert scikit-learn plotly Pillow +matplotlib seaborn xgboost -joblib==1.1.0 +joblib textblob tensorflow torch