From c6d546ad5c47cf1bb84c9833565396efb90e1b11 Mon Sep 17 00:00:00 2001 From: Weixian Zhou Date: Tue, 23 Jul 2024 15:58:38 -0700 Subject: [PATCH] update link. (#46) --- ...ith Feature Store and Model Registry.ipynb | 341 +++++++++--------- README.md | 8 +- 2 files changed, 178 insertions(+), 171 deletions(-) diff --git a/End-to-end ML with Feature Store and Model Registry/End-to-end ML with Feature Store and Model Registry.ipynb b/End-to-end ML with Feature Store and Model Registry/End-to-end ML with Feature Store and Model Registry.ipynb index 9427b67..cafeef4 100644 --- a/End-to-end ML with Feature Store and Model Registry/End-to-end ML with Feature Store and Model Registry.ipynb +++ b/End-to-end ML with Feature Store and Model Registry/End-to-end ML with Feature Store and Model Registry.ipynb @@ -6,7 +6,7 @@ "metadata": {}, "source": [ "- Required snowflake-ml-python version **1.5.5** or higher\n", - "- Last updated on: 7/22/2024" + "- Last updated on: 7/23/2024" ] }, { @@ -586,38 +586,38 @@ " \n", " \n", " 0\n", - " 8.5\n", - " 161\n", - " 68\n", - " 2016-01-08 10:47:49\n", + " 6.0\n", + " 141\n", + " 262\n", + " 2016-01-17 04:01:32\n", " \n", " \n", " 1\n", - " 6.0\n", - " 234\n", + " 11.5\n", + " 13\n", " 114\n", - " 2016-01-09 17:14:42\n", + " 2016-01-16 15:28:48\n", " \n", " \n", " 2\n", - " 5.0\n", - " 87\n", - " 231\n", - " 2016-01-08 13:26:55\n", + " 6.5\n", + " 143\n", + " 48\n", + " 2016-01-18 18:33:35\n", " \n", " \n", " 3\n", - " 7.5\n", - " 170\n", + " 9.0\n", " 79\n", - " 2016-01-09 10:45:00\n", + " 144\n", + " 2016-01-16 19:55:33\n", " \n", " \n", " 4\n", - " 28.0\n", - " 97\n", - " 143\n", - " 2016-01-07 22:11:59\n", + " 10.0\n", + " 43\n", + " 48\n", + " 2016-01-17 16:56:00\n", " \n", " \n", " ...\n", @@ -628,38 +628,38 @@ " \n", " \n", " 507\n", - " 13.0\n", - " 231\n", - " 48\n", - " 2016-01-04 18:00:32\n", + " 30.0\n", + " 138\n", + " 164\n", + " 2016-01-11 19:18:10\n", " \n", " \n", " 508\n", - " 52.0\n", - " 132\n", - " 244\n", - " 2016-01-06 06:16:31\n", + " 12.5\n", + " 148\n", + " 80\n", + " 2016-01-10 22:01:55\n", " \n", " \n", " 509\n", - " 12.5\n", - " 226\n", - " 162\n", - " 2016-01-05 08:29:48\n", + " 5.5\n", + " 114\n", + " 234\n", + " 2016-01-12 08:22:14\n", " \n", " \n", " 510\n", - " 7.0\n", - " 79\n", - " 107\n", - " 2016-01-06 18:02:51\n", + " 12.5\n", + " 163\n", + " 186\n", + " 2016-01-13 12:17:40\n", " \n", " \n", " 511\n", - " 22.0\n", - " 161\n", - " 33\n", - " 2016-01-05 22:55:57\n", + " 10.5\n", + " 141\n", + " 107\n", + " 2016-01-12 20:17:50\n", " \n", " \n", "\n", @@ -668,17 +668,17 @@ ], "text/plain": [ " FARE_AMOUNT PULOCATIONID DOLOCATIONID TPEP_PICKUP_DATETIME\n", - "0 8.5 161 68 2016-01-08 10:47:49\n", - "1 6.0 234 114 2016-01-09 17:14:42\n", - "2 5.0 87 231 2016-01-08 13:26:55\n", - "3 7.5 170 79 2016-01-09 10:45:00\n", - "4 28.0 97 143 2016-01-07 22:11:59\n", + "0 6.0 141 262 2016-01-17 04:01:32\n", + "1 11.5 13 114 2016-01-16 15:28:48\n", + "2 6.5 143 48 2016-01-18 18:33:35\n", + "3 9.0 79 144 2016-01-16 19:55:33\n", + "4 10.0 43 48 2016-01-17 16:56:00\n", ".. ... ... ... ...\n", - "507 13.0 231 48 2016-01-04 18:00:32\n", - "508 52.0 132 244 2016-01-06 06:16:31\n", - "509 12.5 226 162 2016-01-05 08:29:48\n", - "510 7.0 79 107 2016-01-06 18:02:51\n", - "511 22.0 161 33 2016-01-05 22:55:57\n", + "507 30.0 138 164 2016-01-11 19:18:10\n", + "508 12.5 148 80 2016-01-10 22:01:55\n", + "509 5.5 114 234 2016-01-12 08:22:14\n", + "510 12.5 163 186 2016-01-13 12:17:40\n", + "511 10.5 141 107 2016-01-12 20:17:50\n", "\n", "[512 rows x 4 columns]" ] @@ -775,57 +775,57 @@ " \n", " \n", " 0\n", - " 15.0\n", - " 125\n", - " 52\n", - " 2016-01-09 01:51:54\n", - " 42\n", - " 164\n", - " 11.920779\n", + " 45.0\n", + " 49\n", + " 132\n", + " 2016-01-03 12:59:47\n", + " 159\n", + " 733\n", + " 13.250000\n", " 1.0\n", " \n", " \n", " 1\n", - " 5.0\n", - " 125\n", - " 231\n", - " 2016-01-20 18:24:09\n", - " 317\n", - " 1532\n", - " 11.256917\n", + " 5.5\n", + " 90\n", + " 246\n", + " 2016-01-03 14:10:00\n", + " 223\n", + " 1061\n", + " 8.885116\n", " 1.0\n", " \n", " \n", " 2\n", - " 7.0\n", - " 125\n", - " 88\n", - " 2016-01-22 00:49:05\n", - " 65\n", - " 317\n", - " 14.458763\n", + " 6.5\n", + " 90\n", + " 100\n", + " 2016-01-07 20:38:05\n", + " 379\n", + " 1553\n", + " 9.551440\n", " 1.0\n", " \n", " \n", " 3\n", - " 32.5\n", - " 138\n", - " 48\n", - " 2016-01-05 21:56:43\n", - " 591\n", - " 2974\n", - " 28.401669\n", + " 6.0\n", + " 90\n", + " 249\n", + " 2016-01-11 16:14:59\n", + " 182\n", + " 1009\n", + " 9.017611\n", " 1.0\n", " \n", " \n", " 4\n", - " 41.0\n", - " 138\n", - " 45\n", - " 2016-01-06 23:03:19\n", - " 50\n", - " 225\n", - " 28.584057\n", + " 38.5\n", + " 90\n", + " 208\n", + " 2016-01-11 23:30:50\n", + " 4\n", + " 11\n", + " 10.553808\n", " 1.0\n", " \n", " \n", @@ -841,57 +841,57 @@ " \n", " \n", " 507\n", - " 6.5\n", - " 162\n", - " 230\n", - " 2016-01-19 08:05:47\n", - " 885\n", - " 1946\n", - " 9.193698\n", + " 22.5\n", + " 87\n", + " 142\n", + " 2016-01-02 19:21:35\n", + " 793\n", + " 3186\n", + " 15.000000\n", " 1.0\n", " \n", " \n", " 508\n", - " 7.5\n", - " 162\n", - " 234\n", - " 2016-01-20 00:37:15\n", - " 165\n", - " 1995\n", - " 11.385578\n", + " 8.5\n", + " 87\n", + " 232\n", + " 2016-01-17 00:48:38\n", + " 174\n", + " 696\n", + " 14.350319\n", " 1.0\n", " \n", " \n", " 509\n", - " 10.0\n", - " 162\n", - " 107\n", - " 2016-01-21 19:45:20\n", - " 692\n", - " 2307\n", - " 11.164576\n", + " 26.0\n", + " 87\n", + " 238\n", + " 2016-01-22 01:48:14\n", + " 126\n", + " 2031\n", + " 17.154028\n", " 1.0\n", " \n", " \n", " 510\n", - " 10.0\n", - " 162\n", - " 113\n", - " 2016-01-22 18:56:25\n", - " 460\n", - " 1692\n", - " 10.909946\n", + " 18.0\n", + " 87\n", + " 233\n", + " 2016-01-26 17:00:03\n", + " 171\n", + " 1021\n", + " 18.904858\n", " 1.0\n", " \n", " \n", " 511\n", - " 51.0\n", - " 162\n", - " 21\n", - " 2016-01-28 00:52:04\n", - " 7\n", - " 29\n", - " 11.724587\n", + " 7.5\n", + " 87\n", + " 144\n", + " 2016-01-30 20:41:48\n", + " 440\n", + " 1555\n", + " 14.146512\n", " 1.0\n", " \n", " \n", @@ -901,30 +901,30 @@ ], "text/plain": [ " FARE_AMOUNT PULOCATIONID DOLOCATIONID TPEP_PICKUP_DATETIME \\\n", - "0 15.0 125 52 2016-01-09 01:51:54 \n", - "1 5.0 125 231 2016-01-20 18:24:09 \n", - "2 7.0 125 88 2016-01-22 00:49:05 \n", - "3 32.5 138 48 2016-01-05 21:56:43 \n", - "4 41.0 138 45 2016-01-06 23:03:19 \n", + "0 45.0 49 132 2016-01-03 12:59:47 \n", + "1 5.5 90 246 2016-01-03 14:10:00 \n", + "2 6.5 90 100 2016-01-07 20:38:05 \n", + "3 6.0 90 249 2016-01-11 16:14:59 \n", + "4 38.5 90 208 2016-01-11 23:30:50 \n", ".. ... ... ... ... \n", - "507 6.5 162 230 2016-01-19 08:05:47 \n", - "508 7.5 162 234 2016-01-20 00:37:15 \n", - "509 10.0 162 107 2016-01-21 19:45:20 \n", - "510 10.0 162 113 2016-01-22 18:56:25 \n", - "511 51.0 162 21 2016-01-28 00:52:04 \n", + "507 22.5 87 142 2016-01-02 19:21:35 \n", + "508 8.5 87 232 2016-01-17 00:48:38 \n", + "509 26.0 87 238 2016-01-22 01:48:14 \n", + "510 18.0 87 233 2016-01-26 17:00:03 \n", + "511 7.5 87 144 2016-01-30 20:41:48 \n", "\n", " TRIP_COUNT_1H TRIP_COUNT_5H MEAN_FARE_2H MEAN_FARE_5H \n", - "0 42 164 11.920779 1.0 \n", - "1 317 1532 11.256917 1.0 \n", - "2 65 317 14.458763 1.0 \n", - "3 591 2974 28.401669 1.0 \n", - "4 50 225 28.584057 1.0 \n", + "0 159 733 13.250000 1.0 \n", + "1 223 1061 8.885116 1.0 \n", + "2 379 1553 9.551440 1.0 \n", + "3 182 1009 9.017611 1.0 \n", + "4 4 11 10.553808 1.0 \n", ".. ... ... ... ... \n", - "507 885 1946 9.193698 1.0 \n", - "508 165 1995 11.385578 1.0 \n", - "509 692 2307 11.164576 1.0 \n", - "510 460 1692 10.909946 1.0 \n", - "511 7 29 11.724587 1.0 \n", + "507 793 3186 15.000000 1.0 \n", + "508 174 696 14.350319 1.0 \n", + "509 126 2031 17.154028 1.0 \n", + "510 171 1021 18.904858 1.0 \n", + "511 440 1555 14.146512 1.0 \n", "\n", "[512 rows x 8 columns]" ] @@ -963,8 +963,8 @@ "name": "stdout", "output_type": "stream", "text": [ - "feature cols: ['MEAN_FARE_2H', 'MEAN_FARE_5H', 'TRIP_COUNT_5H', 'TRIP_COUNT_1H']\n", - "MSE: 101.03885521242017, Accuracy: 99.50167389473202\n" + "feature cols: ['MEAN_FARE_5H', 'TRIP_COUNT_1H', 'MEAN_FARE_2H', 'TRIP_COUNT_5H']\n", + "MSE: 75.24297705532979, Accuracy: 99.51747145680564\n" ] } ], @@ -1146,23 +1146,30 @@ "my_dataset.lineage(direction=\"downstream\")" ] }, - { - "cell_type": "markdown", - "id": "a99250b6-9ede-416e-b5d0-14693c8ecc43", - "metadata": {}, - "source": [ - "There's a bug causing below cell not return Dataset as downstream lineage object of feature view. We are working on fixing it." - ] - }, { "cell_type": "code", "execution_count": 18, "id": "2c0828fa-e56f-43d7-89fc-dafa7dcce9a5", "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "[Dataset(\n", + " name='REGTEST_DB.SNOWFLAKE_FEATURE_STORE_NOTEBOOK_DEMO.MY_COOL_TRAINING_DATASET',\n", + " version='4.0',\n", + ")]\n", + "[Dataset(\n", + " name='REGTEST_DB.SNOWFLAKE_FEATURE_STORE_NOTEBOOK_DEMO.MY_COOL_TRAINING_DATASET',\n", + " version='4.0',\n", + ")]\n" + ] + } + ], "source": [ "for fv in all_feature_views:\n", - " fv.lineage(direction='downstream')" + " print(fv.lineage(direction='downstream'))" ] }, { @@ -1195,9 +1202,9 @@ "--------------------------------------------------------------------------------------------------------------------\n", "|\"FARE_AMOUNT\" |\"TPEP_PICKUP_DATETIME\" |\"TRIP_COUNT_1H\" |\"TRIP_COUNT_5H\" |\"MEAN_FARE_2H\" |\"MEAN_FARE_5H\" |\n", "--------------------------------------------------------------------------------------------------------------------\n", - "|33.0 |2016-01-10 20:11:11 |27 |112 |11.381987577639752 |1.000000 |\n", - "|15.5 |2016-01-28 03:18:50 |35 |907 |12.427487352445194 |1.000000 |\n", - "|6.5 |2016-01-07 16:49:59 |495 |3035 |10.373705179282869 |1.000000 |\n", + "|5.5 |2016-01-22 23:32:29 |667 |3436 |11.094810393258433 |1.000000 |\n", + "|15.0 |2016-01-28 08:11:04 |243 |625 |10.034979423868313 |1.000000 |\n", + "|4.5 |2016-01-05 05:55:20 |49 |142 |11.541666666666666 |1.000000 |\n", "--------------------------------------------------------------------------------------------------------------------\n", "\n" ] @@ -1239,14 +1246,14 @@ "output_type": "stream", "text": [ " FARE_AMOUNT TPEP_PICKUP_DATETIME TRIP_COUNT_1H TRIP_COUNT_5H \\\n", - "0 10.0 2016-01-28 08:57:11 1559 4636 \n", - "1 6.5 2016-01-29 07:02:50 137 239 \n", - "2 7.0 2016-01-09 10:06:25 225 521 \n", + "0 7.5 2016-01-18 20:38:04 508 3218 \n", + "1 6.0 2016-01-20 19:16:44 787 3382 \n", + "2 10.5 2016-01-27 21:56:09 260 1462 \n", "\n", " MEAN_FARE_2H MEAN_FARE_5H OUTPUT_FARE_AMOUNT \n", - "0 9.863181 1.0 8.751825 \n", - "1 23.330000 1.0 21.714971 \n", - "2 9.970138 1.0 10.083706 \n" + "0 8.041699 1.0 8.970419 \n", + "1 11.068249 1.0 8.970419 \n", + "2 13.664326 1.0 13.003228 \n" ] } ], @@ -1276,15 +1283,15 @@ "name": "stdout", "output_type": "stream", "text": [ - " MEAN_FARE_2H MEAN_FARE_5H TRIP_COUNT_5H TRIP_COUNT_1H \\\n", - "0 12.713693 1.0 4544 739 \n", - "1 13.123772 1.0 3463 245 \n", - "2 9.186856 1.0 4495 878 \n", + " MEAN_FARE_5H TRIP_COUNT_1H MEAN_FARE_2H TRIP_COUNT_5H \\\n", + "0 1.0 69 46.481895 288 \n", + "1 1.0 136 17.565068 620 \n", + "2 1.0 251 10.356322 896 \n", "\n", " OUTPUT_FARE_AMOUNT \n", - "0 10.083857 \n", - "1 10.548088 \n", - "2 8.751825 \n" + "0 49.837721 \n", + "1 14.185978 \n", + "2 8.970419 \n" ] } ], diff --git a/README.md b/README.md index ff95bc1..7f156dc 100644 --- a/README.md +++ b/README.md @@ -52,10 +52,10 @@ This repo contains a collection of Snowflake Notebook demos, tutorials, and exam
  • End-to-End Machine Learning with Snowpark ML 🎥
  • Hyperparameter Tuning with sklearn
  • Getting Started with Snowflake Cortex ML-Based Functions
  • -
  • Feature Store Quickstart
  • -
  • Feature Store API Overview
  • -
  • End-to-end ML with Feature Store and Model Registry
  • -
  • Manage features in DBT with Feature Store
  • +
  • Feature Store Quickstart
  • +
  • Feature Store API Overview
  • +
  • End-to-end ML with Feature Store and Model Registry
  • +
  • Manage features in DBT with Feature Store