From 3f1a39edfbe29ea53e65a7db17a3e4baae8a49e4 Mon Sep 17 00:00:00 2001 From: "Santiago L. Valdarrama" Date: Thu, 28 Mar 2024 11:09:29 -0400 Subject: [PATCH] ... --- program/cohort.ipynb | 386 ++++++++++++++++++++++--------------------- 1 file changed, 194 insertions(+), 192 deletions(-) diff --git a/program/cohort.ipynb b/program/cohort.ipynb index 6b8a1bb..8353afc 100644 --- a/program/cohort.ipynb +++ b/program/cohort.ipynb @@ -46,7 +46,7 @@ }, { "cell_type": "code", - "execution_count": 234, + "execution_count": 341, "id": "4b2265b0", "metadata": { "tags": [ @@ -104,7 +104,7 @@ }, { "cell_type": "code", - "execution_count": 235, + "execution_count": 342, "id": "32c4d764", "metadata": { "tags": [] @@ -124,7 +124,7 @@ }, { "cell_type": "code", - "execution_count": 236, + "execution_count": 343, "id": "3164a3af", "metadata": {}, "outputs": [], @@ -148,7 +148,7 @@ }, { "cell_type": "code", - "execution_count": 237, + "execution_count": 344, "id": "7bc40d28", "metadata": {}, "outputs": [], @@ -170,7 +170,7 @@ }, { "cell_type": "code", - "execution_count": 238, + "execution_count": 345, "id": "3b3f17e5", "metadata": {}, "outputs": [], @@ -213,7 +213,7 @@ }, { "cell_type": "code", - "execution_count": 239, + "execution_count": 346, "id": "942a01b5", "metadata": {}, "outputs": [], @@ -248,7 +248,7 @@ }, { "cell_type": "code", - "execution_count": 240, + "execution_count": 347, "id": "f1cd2f0e-446d-48a9-a008-b4f1cc593bfc", "metadata": { "tags": [] @@ -355,7 +355,7 @@ "4 3450.0 FEMALE " ] }, - "execution_count": 240, + "execution_count": 347, "metadata": {}, "output_type": "execute_result" } @@ -398,7 +398,7 @@ }, { "cell_type": "code", - "execution_count": 241, + "execution_count": 348, "id": "f2107c25-e730-4e22-a1b8-5bda53e61124", "metadata": { "tags": [] @@ -577,7 +577,7 @@ "max 6300.000000 NaN " ] }, - "execution_count": 241, + "execution_count": 348, "metadata": {}, "output_type": "execute_result" } @@ -596,7 +596,7 @@ }, { "cell_type": "code", - "execution_count": 242, + "execution_count": 349, "id": "1242122a-726e-4c37-a718-dd8e873d1612", "metadata": { "tags": [] @@ -652,7 +652,7 @@ }, { "cell_type": "code", - "execution_count": 243, + "execution_count": 350, "id": "cf1cf582-8831-4f83-bb17-2175afb193e8", "metadata": { "tags": [] @@ -667,7 +667,7 @@ "Name: count, dtype: int64" ] }, - "execution_count": 243, + "execution_count": 350, "metadata": {}, "output_type": "execute_result" } @@ -690,7 +690,7 @@ }, { "cell_type": "code", - "execution_count": 244, + "execution_count": 351, "id": "cc42cb08-275c-4b05-9d2b-77052da2f336", "metadata": { "tags": [] @@ -709,7 +709,7 @@ "dtype: int64" ] }, - "execution_count": 244, + "execution_count": 351, "metadata": {}, "output_type": "execute_result" } @@ -728,7 +728,7 @@ }, { "cell_type": "code", - "execution_count": 245, + "execution_count": 352, "id": "3c57d55d-afd6-467a-a7a8-ff04132770ed", "metadata": { "tags": [] @@ -747,7 +747,7 @@ "dtype: int64" ] }, - "execution_count": 245, + "execution_count": 352, "metadata": {}, "output_type": "execute_result" } @@ -772,7 +772,7 @@ }, { "cell_type": "code", - "execution_count": 246, + "execution_count": 353, "id": "2852c740", "metadata": {}, "outputs": [ @@ -818,7 +818,7 @@ }, { "cell_type": "code", - "execution_count": 247, + "execution_count": 354, "id": "707cc972", "metadata": {}, "outputs": [ @@ -866,7 +866,7 @@ }, { "cell_type": "code", - "execution_count": 248, + "execution_count": 355, "id": "3daf3ba1-d218-4ad4-b862-af679b91273f", "metadata": { "tags": [] @@ -946,7 +946,7 @@ "body_mass_g 640316.716388 " ] }, - "execution_count": 248, + "execution_count": 355, "metadata": {}, "output_type": "execute_result" } @@ -977,7 +977,7 @@ }, { "cell_type": "code", - "execution_count": 249, + "execution_count": 356, "id": "1d793e09-2cb9-47ff-a0e6-199a0f4fc1b3", "metadata": { "tags": [] @@ -1057,7 +1057,7 @@ "body_mass_g 1.000000 " ] }, - "execution_count": 249, + "execution_count": 356, "metadata": {}, "output_type": "execute_result" } @@ -1088,7 +1088,7 @@ }, { "cell_type": "code", - "execution_count": 250, + "execution_count": 357, "id": "1258c99d", "metadata": {}, "outputs": [ @@ -1128,7 +1128,7 @@ }, { "cell_type": "code", - "execution_count": 251, + "execution_count": 358, "id": "45b0a87f-028d-477f-9b65-199728c0b7ee", "metadata": { "tags": [] @@ -1198,7 +1198,7 @@ }, { "cell_type": "code", - "execution_count": 252, + "execution_count": 359, "id": "78fe069e", "metadata": {}, "outputs": [], @@ -1217,7 +1217,7 @@ }, { "cell_type": "code", - "execution_count": 253, + "execution_count": 360, "id": "fb6ba7c0-1bd6-4fe5-8b7f-f6cbdfd3846c", "metadata": { "tags": [ @@ -1444,7 +1444,7 @@ }, { "cell_type": "code", - "execution_count": 254, + "execution_count": 361, "id": "d1f122a4-acff-4687-91b9-bfef13567d88", "metadata": { "tags": [ @@ -1457,7 +1457,7 @@ "output_type": "stream", "text": [ "\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\n", - "\u001b[32m\u001b[32m\u001b[1m8 passed\u001b[0m\u001b[32m in 0.16s\u001b[0m\u001b[0m\n" + "\u001b[32m\u001b[32m\u001b[1m8 passed\u001b[0m\u001b[32m in 0.21s\u001b[0m\u001b[0m\n" ] } ], @@ -1580,7 +1580,7 @@ }, { "cell_type": "code", - "execution_count": 255, + "execution_count": 362, "id": "d88e9ccf", "metadata": {}, "outputs": [], @@ -1602,7 +1602,7 @@ }, { "cell_type": "code", - "execution_count": 256, + "execution_count": 363, "id": "331fe373", "metadata": {}, "outputs": [], @@ -1638,7 +1638,7 @@ }, { "cell_type": "code", - "execution_count": 257, + "execution_count": 364, "id": "3aa4471a", "metadata": { "tags": [ @@ -1685,7 +1685,7 @@ }, { "cell_type": "code", - "execution_count": 258, + "execution_count": 365, "id": "cdbd9303", "metadata": { "tags": [ @@ -1765,7 +1765,7 @@ }, { "cell_type": "code", - "execution_count": 259, + "execution_count": 366, "id": "e140642a", "metadata": { "tags": [ @@ -1777,16 +1777,16 @@ "data": { "text/plain": [ "{'PipelineArn': 'arn:aws:sagemaker:us-east-1:325223348818:pipeline/session3-pipeline',\n", - " 'ResponseMetadata': {'RequestId': '40f960ad-5806-45ab-8b2a-e6739b4f2a12',\n", + " 'ResponseMetadata': {'RequestId': '33e834eb-1456-41a2-9ad1-6f55cc21e552',\n", " 'HTTPStatusCode': 200,\n", - " 'HTTPHeaders': {'x-amzn-requestid': '40f960ad-5806-45ab-8b2a-e6739b4f2a12',\n", + " 'HTTPHeaders': {'x-amzn-requestid': '33e834eb-1456-41a2-9ad1-6f55cc21e552',\n", " 'content-type': 'application/x-amz-json-1.1',\n", " 'content-length': '85',\n", - " 'date': 'Wed, 27 Mar 2024 20:03:28 GMT'},\n", + " 'date': 'Thu, 28 Mar 2024 14:14:07 GMT'},\n", " 'RetryAttempts': 0}}" ] }, - "execution_count": 259, + "execution_count": 366, "metadata": {}, "output_type": "execute_result" } @@ -1841,7 +1841,7 @@ }, { "cell_type": "code", - "execution_count": 260, + "execution_count": 367, "id": "ac0b891c", "metadata": {}, "outputs": [], @@ -1860,7 +1860,7 @@ }, { "cell_type": "code", - "execution_count": 261, + "execution_count": 368, "id": "d92b121d-dcb9-43e8-9ee3-3ececb583e7e", "metadata": { "tags": [ @@ -2039,7 +2039,7 @@ }, { "cell_type": "code", - "execution_count": 262, + "execution_count": 369, "id": "14ea27ce-c453-4cb0-b309-dbecd732957e", "metadata": { "tags": [ @@ -2059,23 +2059,23 @@ "output_type": "stream", "text": [ "Keras version: 2.14.0\n", - "8/8 - 0s - loss: 1.1822 - accuracy: 0.2008 - val_loss: 1.1507 - val_accuracy: 0.1961 - 283ms/epoch - 35ms/step\n", - "2/2 [==============================] - 0s 2ms/step\n", - "Validation accuracy: 0.19607843137254902\n" + "8/8 - 0s - loss: 1.1168 - accuracy: 0.2803 - val_loss: 1.0989 - val_accuracy: 0.4314 - 247ms/epoch - 31ms/step\n", + "2/2 [==============================] - 0s 1ms/step\n", + "Validation accuracy: 0.43137254901960786\n" ] }, { "name": "stderr", "output_type": "stream", "text": [ - "INFO:tensorflow:Assets written to: /var/folders/4c/v1q3hy1x4mb5w0wpc72zl3_w0000gp/T/tmpf8bynrmn/model/001/assets\n" + "INFO:tensorflow:Assets written to: /var/folders/4c/v1q3hy1x4mb5w0wpc72zl3_w0000gp/T/tmp8tdths9g/model/001/assets\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ - "\u001b[32m.\u001b[0m" + "\u001b[32m.\u001b[0mKeras version: 2.14.0\n" ] }, { @@ -2089,25 +2089,24 @@ "name": "stdout", "output_type": "stream", "text": [ - "Keras version: 2.14.0\n", - "8/8 - 0s - loss: 1.1754 - accuracy: 0.4519 - val_loss: 1.1591 - val_accuracy: 0.4118 - 229ms/epoch - 29ms/step\n", - "2/2 [==============================] - 0s 2ms/step\n" + "8/8 - 0s - loss: 1.1583 - accuracy: 0.2594 - val_loss: 1.1217 - val_accuracy: 0.3137 - 234ms/epoch - 29ms/step\n", + "2/2 [==============================] - 0s 3ms/step\n", + "Validation accuracy: 0.3137254901960784\n" ] }, { "name": "stderr", "output_type": "stream", "text": [ - "INFO:tensorflow:Assets written to: /var/folders/4c/v1q3hy1x4mb5w0wpc72zl3_w0000gp/T/tmpzxy6bbi_/model/001/assets\n" + "INFO:tensorflow:Assets written to: /var/folders/4c/v1q3hy1x4mb5w0wpc72zl3_w0000gp/T/tmpcpi85j8s/model/001/assets\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ - "Validation accuracy: 0.4117647058823529\n", "\u001b[32m.\u001b[0m\n", - "\u001b[32m\u001b[32m\u001b[1m2 passed\u001b[0m\u001b[32m in 1.14s\u001b[0m\u001b[0m\n" + "\u001b[32m\u001b[32m\u001b[1m2 passed\u001b[0m\u001b[32m in 1.09s\u001b[0m\u001b[0m\n" ] } ], @@ -2187,7 +2186,7 @@ }, { "cell_type": "code", - "execution_count": 263, + "execution_count": 370, "id": "d00eda86", "metadata": { "tags": [ @@ -2231,7 +2230,7 @@ }, { "cell_type": "code", - "execution_count": 264, + "execution_count": 371, "id": "90fe82ae-6a2c-4461-bc83-bb52d8871e3b", "metadata": { "tags": [] @@ -2297,7 +2296,7 @@ }, { "cell_type": "code", - "execution_count": 265, + "execution_count": 372, "id": "99e4850c-83d6-4f4e-a813-d5a3f4bb7486", "metadata": { "tags": [ @@ -2366,7 +2365,7 @@ }, { "cell_type": "code", - "execution_count": 266, + "execution_count": 373, "id": "d92cac3d", "metadata": { "tags": [ @@ -2386,16 +2385,16 @@ "data": { "text/plain": [ "{'PipelineArn': 'arn:aws:sagemaker:us-east-1:325223348818:pipeline/session4-pipeline',\n", - " 'ResponseMetadata': {'RequestId': 'c9d2adbc-a7db-42ce-b957-031745d882b2',\n", + " 'ResponseMetadata': {'RequestId': '2d25d06c-d582-428e-a6ea-985e47324a3c',\n", " 'HTTPStatusCode': 200,\n", - " 'HTTPHeaders': {'x-amzn-requestid': 'c9d2adbc-a7db-42ce-b957-031745d882b2',\n", + " 'HTTPHeaders': {'x-amzn-requestid': '2d25d06c-d582-428e-a6ea-985e47324a3c',\n", " 'content-type': 'application/x-amz-json-1.1',\n", " 'content-length': '85',\n", - " 'date': 'Wed, 27 Mar 2024 20:03:31 GMT'},\n", + " 'date': 'Thu, 28 Mar 2024 14:14:10 GMT'},\n", " 'RetryAttempts': 0}}" ] }, - "execution_count": 266, + "execution_count": 373, "metadata": {}, "output_type": "execute_result" } @@ -2439,7 +2438,7 @@ }, { "cell_type": "code", - "execution_count": 340, + "execution_count": 374, "id": "57c2915c", "metadata": {}, "outputs": [ @@ -2449,7 +2448,7 @@ "PosixPath('code/containers/training/train.py')" ] }, - "execution_count": 340, + "execution_count": 374, "metadata": {}, "output_type": "execute_result" } @@ -2476,7 +2475,7 @@ }, { "cell_type": "code", - "execution_count": 268, + "execution_count": 375, "id": "3ffa9250", "metadata": { "tags": [ @@ -2518,7 +2517,7 @@ }, { "cell_type": "code", - "execution_count": 269, + "execution_count": 376, "id": "de5d473c", "metadata": { "tags": [ @@ -2573,7 +2572,7 @@ }, { "cell_type": "code", - "execution_count": 270, + "execution_count": 377, "id": "e37a06ac", "metadata": { "tags": [ @@ -2592,7 +2591,7 @@ "\u001b[0m\u001b[34m => => transferring dockerfile: 647B 0.0s\n", "\u001b[0m\u001b[34m => [internal] load .dockerignore 0.0s\n", "\u001b[0m\u001b[34m => => transferring context: 2B 0.0s\n", - "\u001b[0m => [internal] load metadata for docker.io/library/python:3.10-slim 0.1s\n", + "\u001b[0m => [internal] load metadata for docker.io/library/python:3.10-slim 0.0s\n", "\u001b[?25h\u001b[1A\u001b[1A\u001b[1A\u001b[1A\u001b[1A\u001b[1A\u001b[0G\u001b[?25l[+] Building 0.3s (2/3) \n", "\u001b[34m => [internal] load build definition from Dockerfile 0.0s\n", "\u001b[0m\u001b[34m => => transferring dockerfile: 647B 0.0s\n", @@ -2604,32 +2603,37 @@ "\u001b[0m\u001b[34m => => transferring dockerfile: 647B 0.0s\n", "\u001b[0m\u001b[34m => [internal] load .dockerignore 0.0s\n", "\u001b[0m\u001b[34m => => transferring context: 2B 0.0s\n", - "\u001b[0m => [internal] load metadata for docker.io/library/python:3.10-slim 0.4s\n", + "\u001b[0m => [internal] load metadata for docker.io/library/python:3.10-slim 0.3s\n", "\u001b[?25h\u001b[1A\u001b[1A\u001b[1A\u001b[1A\u001b[1A\u001b[1A\u001b[0G\u001b[?25l[+] Building 0.6s (2/3) \n", "\u001b[34m => [internal] load build definition from Dockerfile 0.0s\n", "\u001b[0m\u001b[34m => => transferring dockerfile: 647B 0.0s\n", "\u001b[0m\u001b[34m => [internal] load .dockerignore 0.0s\n", "\u001b[0m\u001b[34m => => transferring context: 2B 0.0s\n", "\u001b[0m => [internal] load metadata for docker.io/library/python:3.10-slim 0.5s\n", - "\u001b[?25h" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "text": [ - "\u001b[1A\u001b[1A\u001b[1A\u001b[1A\u001b[1A\u001b[1A\u001b[0G\u001b[?25l[+] Building 0.7s (2/3) \n", + "\u001b[?25h\u001b[1A\u001b[1A\u001b[1A\u001b[1A\u001b[1A\u001b[1A\u001b[0G\u001b[?25l[+] Building 0.7s (2/3) \n", "\u001b[34m => [internal] load build definition from Dockerfile 0.0s\n", "\u001b[0m\u001b[34m => => transferring dockerfile: 647B 0.0s\n", "\u001b[0m\u001b[34m => [internal] load .dockerignore 0.0s\n", "\u001b[0m\u001b[34m => => transferring context: 2B 0.0s\n", - "\u001b[0m => [internal] load metadata for docker.io/library/python:3.10-slim 0.7s\n", - "\u001b[?25h\u001b[1A\u001b[1A\u001b[1A\u001b[1A\u001b[1A\u001b[1A\u001b[0G\u001b[?25l[+] Building 0.8s (11/11) FINISHED \n", + "\u001b[0m => [internal] load metadata for docker.io/library/python:3.10-slim 0.6s\n", + "\u001b[?25h\u001b[1A\u001b[1A\u001b[1A\u001b[1A\u001b[1A\u001b[1A\u001b[0G\u001b[?25l[+] Building 0.9s (2/3) \n", "\u001b[34m => [internal] load build definition from Dockerfile 0.0s\n", "\u001b[0m\u001b[34m => => transferring dockerfile: 647B 0.0s\n", "\u001b[0m\u001b[34m => [internal] load .dockerignore 0.0s\n", "\u001b[0m\u001b[34m => => transferring context: 2B 0.0s\n", - "\u001b[0m\u001b[34m => [internal] load metadata for docker.io/library/python:3.10-slim 0.7s\n", + "\u001b[0m => [internal] load metadata for docker.io/library/python:3.10-slim 0.8s\n", + "\u001b[?25h\u001b[1A\u001b[1A\u001b[1A\u001b[1A\u001b[1A\u001b[1A\u001b[0G\u001b[?25l[+] Building 1.0s (3/3) \n", + "\u001b[34m => [internal] load build definition from Dockerfile 0.0s\n", + "\u001b[0m\u001b[34m => => transferring dockerfile: 647B 0.0s\n", + "\u001b[0m\u001b[34m => [internal] load .dockerignore 0.0s\n", + "\u001b[0m\u001b[34m => => transferring context: 2B 0.0s\n", + "\u001b[0m\u001b[34m => [internal] load metadata for docker.io/library/python:3.10-slim 0.9s\n", + "\u001b[0m\u001b[?25h\u001b[1A\u001b[1A\u001b[1A\u001b[1A\u001b[1A\u001b[1A\u001b[0G\u001b[?25l[+] Building 1.0s (11/11) FINISHED \n", + "\u001b[34m => [internal] load build definition from Dockerfile 0.0s\n", + "\u001b[0m\u001b[34m => => transferring dockerfile: 647B 0.0s\n", + "\u001b[0m\u001b[34m => [internal] load .dockerignore 0.0s\n", + "\u001b[0m\u001b[34m => => transferring context: 2B 0.0s\n", + "\u001b[0m\u001b[34m => [internal] load metadata for docker.io/library/python:3.10-slim 0.9s\n", "\u001b[0m\u001b[34m => [1/6] FROM docker.io/library/python:3.10-slim@sha256:f80e619e067eebe4 0.0s\n", "\u001b[0m\u001b[34m => [internal] load build context 0.0s\n", "\u001b[0m\u001b[34m => => transferring context: 4.95kB 0.0s\n", @@ -2642,7 +2646,14 @@ "\u001b[0m\u001b[34m => => exporting layers 0.0s\n", "\u001b[0m\u001b[34m => => writing image sha256:952fdf459612946969bb2cdf46ca507616c57dd316232 0.0s\n", "\u001b[0m\u001b[34m => => naming to docker.io/library/keras-custom-training-container 0.0s\n", - "\u001b[0m\u001b[?25h\n", + "\u001b[0m\u001b[?25h" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "text": [ + "\n", "Use 'docker scan' to run Snyk tests against images to find vulnerabilities and learn how to fix them\n" ] } @@ -2681,7 +2692,7 @@ }, { "cell_type": "code", - "execution_count": 271, + "execution_count": 378, "id": "ceede5e2", "metadata": { "tags": [ @@ -2710,16 +2721,16 @@ "884af60a304e: Waiting\n", "c8f253aef560: Waiting\n", "a483da8ab3e9: Waiting\n", - "25f8ff0f81d0: Layer already exists\n", + "d2e84e969834: Layer already exists\n", + "dc9f227d801d: Layer already exists\n", "56cff974c816: Layer already exists\n", + "25f8ff0f81d0: Layer already exists\n", "78ea0a62e625: Layer already exists\n", - "dc9f227d801d: Layer already exists\n", - "d2e84e969834: Layer already exists\n", "9362be696331: Layer already exists\n", "23cef6a8f8d1: Layer already exists\n", "884af60a304e: Layer already exists\n", - "c8f253aef560: Layer already exists\n", "a483da8ab3e9: Layer already exists\n", + "c8f253aef560: Layer already exists\n", "latest: digest: sha256:66434da50d99b87f7c1956ad680873e2921b23938a4090d7df8977446bccddeb size: 2422\n" ] } @@ -2777,7 +2788,7 @@ }, { "cell_type": "code", - "execution_count": 272, + "execution_count": 379, "id": "49d9ab0e", "metadata": {}, "outputs": [ @@ -2787,7 +2798,7 @@ "'325223348818.dkr.ecr.us-east-1.amazonaws.com/keras-custom-training-container:latest'" ] }, - "execution_count": 272, + "execution_count": 379, "metadata": {}, "output_type": "execute_result" } @@ -2819,7 +2830,7 @@ }, { "cell_type": "code", - "execution_count": 273, + "execution_count": 380, "id": "f4e17204", "metadata": { "tags": [ @@ -2862,7 +2873,7 @@ }, { "cell_type": "code", - "execution_count": 274, + "execution_count": 381, "id": "86056197", "metadata": { "tags": [ @@ -2874,16 +2885,16 @@ "data": { "text/plain": [ "{'PipelineArn': 'arn:aws:sagemaker:us-east-1:325223348818:pipeline/session5-pipeline',\n", - " 'ResponseMetadata': {'RequestId': 'a02c89c2-375c-4ffc-a893-9e05b4d39edb',\n", + " 'ResponseMetadata': {'RequestId': '9a35c31b-3a23-45b7-9ea2-0a5822d704cd',\n", " 'HTTPStatusCode': 200,\n", - " 'HTTPHeaders': {'x-amzn-requestid': 'a02c89c2-375c-4ffc-a893-9e05b4d39edb',\n", + " 'HTTPHeaders': {'x-amzn-requestid': '9a35c31b-3a23-45b7-9ea2-0a5822d704cd',\n", " 'content-type': 'application/x-amz-json-1.1',\n", " 'content-length': '85',\n", - " 'date': 'Wed, 27 Mar 2024 20:03:39 GMT'},\n", + " 'date': 'Thu, 28 Mar 2024 14:14:29 GMT'},\n", " 'RetryAttempts': 0}}" ] }, - "execution_count": 274, + "execution_count": 381, "metadata": {}, "output_type": "execute_result" } @@ -2929,7 +2940,7 @@ }, { "cell_type": "code", - "execution_count": 275, + "execution_count": 382, "id": "f367d0e3", "metadata": {}, "outputs": [], @@ -2964,7 +2975,7 @@ }, { "cell_type": "code", - "execution_count": 276, + "execution_count": 383, "id": "c8c82750", "metadata": {}, "outputs": [], @@ -2997,12 +3008,21 @@ }, { "cell_type": "code", - "execution_count": 277, + "execution_count": 384, "id": "038ff2e5-ed28-445b-bc03-4e996ec2286f", "metadata": { "tags": [] }, - "outputs": [], + "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "/Users/svpino/dev/ml.school/.venv/lib/python3.10/site-packages/sagemaker/workflow/pipeline_context.py:332: UserWarning: Running within a PipelineSession, there will be No Wait, No Logs, and No Job being started.\n", + " warnings.warn(\n" + ] + } + ], "source": [ "from sagemaker.workflow.steps import TuningStep\n", "\n", @@ -3046,7 +3066,7 @@ }, { "cell_type": "code", - "execution_count": 278, + "execution_count": 385, "id": "9799ab39-fcae-41f4-a68b-85ab71b3ba9a", "metadata": { "tags": [ @@ -3078,16 +3098,16 @@ "data": { "text/plain": [ "{'PipelineArn': 'arn:aws:sagemaker:us-east-1:325223348818:pipeline/session6-pipeline',\n", - " 'ResponseMetadata': {'RequestId': '43d53f84-a7f4-41bf-b91b-938735bbaba4',\n", + " 'ResponseMetadata': {'RequestId': 'a87eeb8c-686e-43e2-8ab5-4e4a57033325',\n", " 'HTTPStatusCode': 200,\n", - " 'HTTPHeaders': {'x-amzn-requestid': '43d53f84-a7f4-41bf-b91b-938735bbaba4',\n", + " 'HTTPHeaders': {'x-amzn-requestid': 'a87eeb8c-686e-43e2-8ab5-4e4a57033325',\n", " 'content-type': 'application/x-amz-json-1.1',\n", " 'content-length': '85',\n", - " 'date': 'Wed, 27 Mar 2024 20:03:41 GMT'},\n", + " 'date': 'Thu, 28 Mar 2024 14:14:31 GMT'},\n", " 'RetryAttempts': 0}}" ] }, - "execution_count": 278, + "execution_count": 385, "metadata": {}, "output_type": "execute_result" } @@ -3143,7 +3163,7 @@ }, { "cell_type": "code", - "execution_count": 279, + "execution_count": 386, "id": "0590fcfa", "metadata": {}, "outputs": [], @@ -3162,7 +3182,7 @@ }, { "cell_type": "code", - "execution_count": 280, + "execution_count": 387, "id": "3ee3ab26-afa5-4ceb-9f7a-005d5fdea646", "metadata": { "tags": [ @@ -3239,7 +3259,7 @@ }, { "cell_type": "code", - "execution_count": 281, + "execution_count": 388, "id": "9a2540d8-278a-4953-bc54-0469d154427d", "metadata": { "tags": [ @@ -3258,23 +3278,17 @@ "name": "stdout", "output_type": "stream", "text": [ - "Keras version: 2.14.0\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "text": [ - "8/8 - 0s - loss: 0.9390 - accuracy: 0.6192 - val_loss: 0.8876 - val_accuracy: 0.7843 - 234ms/epoch - 29ms/step\n", + "Keras version: 2.14.0\n", + "8/8 - 0s - loss: 1.5299 - accuracy: 0.4477 - val_loss: 1.4370 - val_accuracy: 0.3922 - 249ms/epoch - 31ms/step\n", "2/2 [==============================] - 0s 3ms/step\n", - "Validation accuracy: 0.7843137254901961\n" + "Validation accuracy: 0.39215686274509803\n" ] }, { "name": "stderr", "output_type": "stream", "text": [ - "INFO:tensorflow:Assets written to: /var/folders/4c/v1q3hy1x4mb5w0wpc72zl3_w0000gp/T/tmp6tq7psl6/model/001/assets\n", + "INFO:tensorflow:Assets written to: /var/folders/4c/v1q3hy1x4mb5w0wpc72zl3_w0000gp/T/tmpexv52705/model/001/assets\n", "WARNING:absl:At this time, the v2.11+ optimizer `tf.keras.optimizers.RestoredOptimizer` runs slowly on M1/M2 Macs, please use the legacy Keras optimizer instead, located at `tf.keras.optimizers.legacy.RestoredOptimizer`.\n", "WARNING:absl:At this time, the v2.11+ optimizer `tf.keras.optimizers.SGD` runs slowly on M1/M2 Macs, please use the legacy Keras optimizer instead, located at `tf.keras.optimizers.legacy.SGD`.\n" ] @@ -3283,8 +3297,8 @@ "name": "stdout", "output_type": "stream", "text": [ - "2/2 [==============================] - 0s 2ms/step\n", - "Test accuracy: 0.5490196078431373\n", + "2/2 [==============================] - 0s 3ms/step\n", + "Test accuracy: 0.43137254901960786\n", "\u001b[32m.\u001b[0m" ] }, @@ -3300,16 +3314,16 @@ "output_type": "stream", "text": [ "Keras version: 2.14.0\n", - "8/8 - 0s - loss: 1.1756 - accuracy: 0.2427 - val_loss: 1.1422 - val_accuracy: 0.2549 - 221ms/epoch - 28ms/step\n", + "8/8 - 0s - loss: 1.3392 - accuracy: 0.1883 - val_loss: 1.2168 - val_accuracy: 0.1765 - 231ms/epoch - 29ms/step\n", "2/2 [==============================] - 0s 2ms/step\n", - "Validation accuracy: 0.2549019607843137\n" + "Validation accuracy: 0.17647058823529413\n" ] }, { "name": "stderr", "output_type": "stream", "text": [ - "INFO:tensorflow:Assets written to: /var/folders/4c/v1q3hy1x4mb5w0wpc72zl3_w0000gp/T/tmp_n5d14v5/model/001/assets\n", + "INFO:tensorflow:Assets written to: /var/folders/4c/v1q3hy1x4mb5w0wpc72zl3_w0000gp/T/tmpusf9ay5r/model/001/assets\n", "WARNING:absl:At this time, the v2.11+ optimizer `tf.keras.optimizers.RestoredOptimizer` runs slowly on M1/M2 Macs, please use the legacy Keras optimizer instead, located at `tf.keras.optimizers.legacy.RestoredOptimizer`.\n", "WARNING:absl:At this time, the v2.11+ optimizer `tf.keras.optimizers.SGD` runs slowly on M1/M2 Macs, please use the legacy Keras optimizer instead, located at `tf.keras.optimizers.legacy.SGD`.\n" ] @@ -3318,10 +3332,10 @@ "name": "stdout", "output_type": "stream", "text": [ - "2/2 [==============================] - 0s 2ms/step\n", - "Test accuracy: 0.19607843137254902\n", + "2/2 [==============================] - 0s 4ms/step\n", + "Test accuracy: 0.21568627450980393\n", "\u001b[32m.\u001b[0m\n", - "\u001b[32m\u001b[32m\u001b[1m2 passed\u001b[0m\u001b[32m in 1.28s\u001b[0m\u001b[0m\n" + "\u001b[32m\u001b[32m\u001b[1m2 passed\u001b[0m\u001b[32m in 1.46s\u001b[0m\u001b[0m\n" ] } ], @@ -3404,7 +3418,7 @@ }, { "cell_type": "code", - "execution_count": 282, + "execution_count": 389, "id": "4f19e15b", "metadata": {}, "outputs": [], @@ -3431,7 +3445,7 @@ }, { "cell_type": "code", - "execution_count": 283, + "execution_count": 390, "id": "1f27b2ef", "metadata": {}, "outputs": [], @@ -3457,7 +3471,7 @@ }, { "cell_type": "code", - "execution_count": 284, + "execution_count": 391, "id": "2fdff07f", "metadata": { "tags": [ @@ -3498,7 +3512,7 @@ }, { "cell_type": "code", - "execution_count": 285, + "execution_count": 392, "id": "48139a07-5c8e-4bc6-b666-bf9531f7f520", "metadata": { "tags": [ @@ -3562,7 +3576,7 @@ }, { "cell_type": "code", - "execution_count": 286, + "execution_count": 393, "id": "21a1ab1f", "metadata": { "tags": [ @@ -3575,13 +3589,7 @@ "output_type": "stream", "text": [ "INFO:sagemaker.image_uris:image_uri is not presented, retrieving image_uri based on instance_type, framework etc.\n", - "INFO:sagemaker.processing:Uploaded None to s3://mlschool/session7-pipeline/code/c90fe2477ad62c58fbc0c004cc5ab07f/sourcedir.tar.gz\n" - ] - }, - { - "name": "stderr", - "output_type": "stream", - "text": [ + "INFO:sagemaker.processing:Uploaded None to s3://mlschool/session7-pipeline/code/c90fe2477ad62c58fbc0c004cc5ab07f/sourcedir.tar.gz\n", "INFO:sagemaker.processing:runproc.sh uploaded to s3://mlschool/session7-pipeline/code/f3b7867d7495763812a03744135acb08/runproc.sh\n", "INFO:sagemaker.image_uris:image_uri is not presented, retrieving image_uri based on instance_type, framework etc.\n", "INFO:sagemaker.processing:Uploaded None to s3://mlschool/session7-pipeline/code/c90fe2477ad62c58fbc0c004cc5ab07f/sourcedir.tar.gz\n", @@ -3592,16 +3600,16 @@ "data": { "text/plain": [ "{'PipelineArn': 'arn:aws:sagemaker:us-east-1:325223348818:pipeline/session7-pipeline',\n", - " 'ResponseMetadata': {'RequestId': '033f9765-ff66-491a-92fd-6aeacad3bb5e',\n", + " 'ResponseMetadata': {'RequestId': '98937049-ca98-4951-8e90-65ac69b77dd2',\n", " 'HTTPStatusCode': 200,\n", - " 'HTTPHeaders': {'x-amzn-requestid': '033f9765-ff66-491a-92fd-6aeacad3bb5e',\n", + " 'HTTPHeaders': {'x-amzn-requestid': '98937049-ca98-4951-8e90-65ac69b77dd2',\n", " 'content-type': 'application/x-amz-json-1.1',\n", " 'content-length': '85',\n", - " 'date': 'Wed, 27 Mar 2024 20:03:44 GMT'},\n", + " 'date': 'Thu, 28 Mar 2024 14:14:34 GMT'},\n", " 'RetryAttempts': 0}}" ] }, - "execution_count": 286, + "execution_count": 393, "metadata": {}, "output_type": "execute_result" } @@ -3646,7 +3654,7 @@ }, { "cell_type": "code", - "execution_count": 287, + "execution_count": 394, "id": "bb70f907", "metadata": {}, "outputs": [], @@ -3666,7 +3674,7 @@ }, { "cell_type": "code", - "execution_count": 288, + "execution_count": 395, "id": "4ca4cb61", "metadata": {}, "outputs": [], @@ -3693,7 +3701,7 @@ }, { "cell_type": "code", - "execution_count": 289, + "execution_count": 396, "id": "8c05a7e1", "metadata": {}, "outputs": [], @@ -3729,7 +3737,7 @@ }, { "cell_type": "code", - "execution_count": 290, + "execution_count": 397, "id": "c9773a4a", "metadata": { "tags": [ @@ -3794,7 +3802,7 @@ }, { "cell_type": "code", - "execution_count": 291, + "execution_count": 398, "id": "4d09cc85", "metadata": { "tags": [ @@ -3806,14 +3814,14 @@ "name": "stderr", "output_type": "stream", "text": [ - "INFO:sagemaker.image_uris:image_uri is not presented, retrieving image_uri based on instance_type, framework etc.\n", - "INFO:sagemaker.processing:Uploaded None to s3://mlschool/session8-pipeline/code/c90fe2477ad62c58fbc0c004cc5ab07f/sourcedir.tar.gz\n" + "INFO:sagemaker.image_uris:image_uri is not presented, retrieving image_uri based on instance_type, framework etc.\n" ] }, { "name": "stderr", "output_type": "stream", "text": [ + "INFO:sagemaker.processing:Uploaded None to s3://mlschool/session8-pipeline/code/c90fe2477ad62c58fbc0c004cc5ab07f/sourcedir.tar.gz\n", "INFO:sagemaker.processing:runproc.sh uploaded to s3://mlschool/session8-pipeline/code/f3b7867d7495763812a03744135acb08/runproc.sh\n", "WARNING:sagemaker.workflow._utils:Popping out 'CertifyForMarketplace' from the pipeline definition since it will be overridden in pipeline execution time.\n", "INFO:sagemaker.image_uris:image_uri is not presented, retrieving image_uri based on instance_type, framework etc.\n", @@ -3825,16 +3833,16 @@ "data": { "text/plain": [ "{'PipelineArn': 'arn:aws:sagemaker:us-east-1:325223348818:pipeline/session8-pipeline',\n", - " 'ResponseMetadata': {'RequestId': '22d21940-e3c2-4bbb-8dab-c16627cda043',\n", + " 'ResponseMetadata': {'RequestId': '851c81af-eabe-4eb5-8187-484437999eef',\n", " 'HTTPStatusCode': 200,\n", - " 'HTTPHeaders': {'x-amzn-requestid': '22d21940-e3c2-4bbb-8dab-c16627cda043',\n", + " 'HTTPHeaders': {'x-amzn-requestid': '851c81af-eabe-4eb5-8187-484437999eef',\n", " 'content-type': 'application/x-amz-json-1.1',\n", " 'content-length': '85',\n", - " 'date': 'Wed, 27 Mar 2024 20:03:47 GMT'},\n", + " 'date': 'Thu, 28 Mar 2024 14:14:36 GMT'},\n", " 'RetryAttempts': 0}}" ] }, - "execution_count": 291, + "execution_count": 398, "metadata": {}, "output_type": "execute_result" } @@ -3882,7 +3890,7 @@ }, { "cell_type": "code", - "execution_count": 292, + "execution_count": 399, "id": "745486b5", "metadata": {}, "outputs": [], @@ -3904,7 +3912,7 @@ }, { "cell_type": "code", - "execution_count": 293, + "execution_count": 400, "id": "c4431bbf", "metadata": {}, "outputs": [], @@ -3935,7 +3943,7 @@ }, { "cell_type": "code", - "execution_count": 294, + "execution_count": 401, "id": "bebeecab", "metadata": {}, "outputs": [], @@ -3965,7 +3973,7 @@ }, { "cell_type": "code", - "execution_count": 295, + "execution_count": 402, "id": "36e2a2b1-6711-4266-95d8-d2aebd52e199", "metadata": { "tags": [] @@ -3994,7 +4002,7 @@ }, { "cell_type": "code", - "execution_count": 296, + "execution_count": 403, "id": "f70bcd33-b499-4e2b-953e-94d1ed96c10a", "metadata": { "tags": [ @@ -4008,13 +4016,7 @@ "text": [ "INFO:sagemaker.image_uris:image_uri is not presented, retrieving image_uri based on instance_type, framework etc.\n", "INFO:sagemaker.processing:Uploaded None to s3://mlschool/session9-pipeline/code/c90fe2477ad62c58fbc0c004cc5ab07f/sourcedir.tar.gz\n", - "INFO:sagemaker.processing:runproc.sh uploaded to s3://mlschool/session9-pipeline/code/f3b7867d7495763812a03744135acb08/runproc.sh\n" - ] - }, - { - "name": "stderr", - "output_type": "stream", - "text": [ + "INFO:sagemaker.processing:runproc.sh uploaded to s3://mlschool/session9-pipeline/code/f3b7867d7495763812a03744135acb08/runproc.sh\n", "INFO:sagemaker.image_uris:image_uri is not presented, retrieving image_uri based on instance_type, framework etc.\n", "INFO:sagemaker.processing:Uploaded None to s3://mlschool/session9-pipeline/code/c90fe2477ad62c58fbc0c004cc5ab07f/sourcedir.tar.gz\n", "INFO:sagemaker.processing:runproc.sh uploaded to s3://mlschool/session9-pipeline/code/f3b7867d7495763812a03744135acb08/runproc.sh\n" @@ -4024,16 +4026,16 @@ "data": { "text/plain": [ "{'PipelineArn': 'arn:aws:sagemaker:us-east-1:325223348818:pipeline/session9-pipeline',\n", - " 'ResponseMetadata': {'RequestId': 'fe777d8c-4909-4e82-883a-48db76c53d23',\n", + " 'ResponseMetadata': {'RequestId': '98d320f5-57fb-402a-885d-30b1829c8477',\n", " 'HTTPStatusCode': 200,\n", - " 'HTTPHeaders': {'x-amzn-requestid': 'fe777d8c-4909-4e82-883a-48db76c53d23',\n", + " 'HTTPHeaders': {'x-amzn-requestid': '98d320f5-57fb-402a-885d-30b1829c8477',\n", " 'content-type': 'application/x-amz-json-1.1',\n", " 'content-length': '85',\n", - " 'date': 'Wed, 27 Mar 2024 20:03:49 GMT'},\n", + " 'date': 'Thu, 28 Mar 2024 14:14:56 GMT'},\n", " 'RetryAttempts': 0}}" ] }, - "execution_count": 296, + "execution_count": 403, "metadata": {}, "output_type": "execute_result" } @@ -4081,7 +4083,7 @@ }, { "cell_type": "code", - "execution_count": 297, + "execution_count": 405, "id": "a67726d7", "metadata": {}, "outputs": [ @@ -4089,14 +4091,14 @@ "data": { "text/plain": [ "{'ModelPackageGroupName': 'basic-penguins',\n", - " 'ModelPackageVersion': 4,\n", - " 'ModelPackageArn': 'arn:aws:sagemaker:us-east-1:325223348818:model-package/basic-penguins/4',\n", - " 'CreationTime': datetime.datetime(2024, 3, 26, 15, 43, 59, 510000, tzinfo=tzlocal()),\n", + " 'ModelPackageVersion': 5,\n", + " 'ModelPackageArn': 'arn:aws:sagemaker:us-east-1:325223348818:model-package/basic-penguins/5',\n", + " 'CreationTime': datetime.datetime(2024, 3, 27, 16, 41, 23, 867000, tzinfo=tzlocal()),\n", " 'ModelPackageStatus': 'Completed',\n", " 'ModelApprovalStatus': 'Approved'}" ] }, - "execution_count": 297, + "execution_count": 405, "metadata": {}, "output_type": "execute_result" } @@ -4138,7 +4140,7 @@ }, { "cell_type": "code", - "execution_count": 298, + "execution_count": 406, "id": "f2e94adc", "metadata": {}, "outputs": [], @@ -4156,7 +4158,7 @@ }, { "cell_type": "code", - "execution_count": 299, + "execution_count": 407, "id": "bd12fbe9", "metadata": {}, "outputs": [], @@ -4186,7 +4188,7 @@ }, { "cell_type": "code", - "execution_count": 300, + "execution_count": 411, "id": "c79a0e74", "metadata": { "tags": [ @@ -4198,7 +4200,7 @@ "name": "stdout", "output_type": "stream", "text": [ - "Overwriting code/serving/app.py\n" + "Writing code/serving/app.py\n" ] } ], @@ -4333,7 +4335,7 @@ }, { "cell_type": "code", - "execution_count": 302, + "execution_count": 413, "id": "dee516e9", "metadata": {}, "outputs": [ @@ -4341,7 +4343,7 @@ "name": "stdout", "output_type": "stream", "text": [ - "arn:aws:sagemaker:us-east-1:325223348818:model-package/basic-penguins/4\n" + "arn:aws:sagemaker:us-east-1:325223348818:model-package/basic-penguins/5\n" ] } ], @@ -4406,7 +4408,7 @@ } ], "source": [ - "# %%script false --no-raise-error\n", + "%%script false --no-raise-error\n", "# | eval: false\n", "\n", "model_package.deploy(\n", @@ -4432,7 +4434,7 @@ }, { "cell_type": "code", - "execution_count": 304, + "execution_count": 417, "id": "ba7da291", "metadata": {}, "outputs": [], @@ -4454,7 +4456,7 @@ }, { "cell_type": "code", - "execution_count": 305, + "execution_count": 418, "id": "0817a25e-8224-4911-830b-d659e7458b4a", "metadata": { "tags": [] @@ -4467,19 +4469,19 @@ "{\n", " \"predictions\": [\n", " [\n", - " 0.0357683785,\n", - " 0.0169553887,\n", - " 0.947276175\n", + " 0.00695773,\n", + " 0.012256721,\n", + " 0.980785549\n", " ],\n", " [\n", - " 0.746489704,\n", - " 0.138009325,\n", - " 0.115500942\n", + " 0.603334665,\n", + " 0.303359121,\n", + " 0.0933062956\n", " ],\n", " [\n", - " 0.932434201,\n", - " 0.0483518168,\n", - " 0.0192140024\n", + " 0.818286,\n", + " 0.157282069,\n", + " 0.0244319625\n", " ]\n", " ]\n", "}\n", @@ -9135,7 +9137,7 @@ }, { "cell_type": "code", - "execution_count": 338, + "execution_count": 404, "id": "59d1e634", "metadata": { "tags": [ @@ -9146,16 +9148,16 @@ { "data": { "text/plain": [ - "_PipelineExecution(arn='arn:aws:sagemaker:us-east-1:325223348818:pipeline/session13-pipeline/execution/q78dup0psxxk', sagemaker_session=)" + "_PipelineExecution(arn='arn:aws:sagemaker:us-east-1:325223348818:pipeline/session9-pipeline/execution/5y50p6okclor', sagemaker_session=)" ] }, - "execution_count": 338, + "execution_count": 404, "metadata": {}, "output_type": "execute_result" } ], "source": [ - "%%script false --no-raise-error\n", + "# %%script false --no-raise-error\n", "# | eval: false\n", "\n", "session13_pipeline.start()"