From 97989a05b8152d29c6056b443f4ea2d50d9e8425 Mon Sep 17 00:00:00 2001 From: "Santiago L. Valdarrama" Date: Mon, 23 Oct 2023 16:02:50 -0400 Subject: [PATCH] Fixing ugly bug with response from server --- program/cohort.ipynb | 310 ++++++++++++++++++++++++------------------- 1 file changed, 177 insertions(+), 133 deletions(-) diff --git a/program/cohort.ipynb b/program/cohort.ipynb index 4ae1dba..6653147 100644 --- a/program/cohort.ipynb +++ b/program/cohort.ipynb @@ -42,7 +42,7 @@ }, { "cell_type": "code", - "execution_count": 80, + "execution_count": 249, "id": "4b2265b0", "metadata": {}, "outputs": [ @@ -100,7 +100,7 @@ }, { "cell_type": "code", - "execution_count": 81, + "execution_count": 250, "id": "32c4d764", "metadata": {}, "outputs": [], @@ -118,7 +118,7 @@ }, { "cell_type": "code", - "execution_count": 82, + "execution_count": 251, "id": "3164a3af", "metadata": {}, "outputs": [], @@ -141,7 +141,7 @@ }, { "cell_type": "code", - "execution_count": 83, + "execution_count": 252, "id": "7bc40d28", "metadata": {}, "outputs": [], @@ -160,7 +160,7 @@ }, { "cell_type": "code", - "execution_count": 84, + "execution_count": 253, "id": "3b3f17e5", "metadata": {}, "outputs": [], @@ -200,7 +200,7 @@ }, { "cell_type": "code", - "execution_count": 85, + "execution_count": 254, "id": "942a01b5", "metadata": {}, "outputs": [], @@ -237,7 +237,7 @@ }, { "cell_type": "code", - "execution_count": 86, + "execution_count": 255, "id": "f1cd2f0e-446d-48a9-a008-b4f1cc593bfc", "metadata": { "tags": [] @@ -344,7 +344,7 @@ "4 3450.0 FEMALE " ] }, - "execution_count": 86, + "execution_count": 255, "metadata": {}, "output_type": "execute_result" } @@ -381,7 +381,7 @@ }, { "cell_type": "code", - "execution_count": 87, + "execution_count": 256, "id": "f2107c25-e730-4e22-a1b8-5bda53e61124", "metadata": { "tags": [] @@ -560,7 +560,7 @@ "max 6300.000000 NaN " ] }, - "execution_count": 87, + "execution_count": 256, "metadata": {}, "output_type": "execute_result" } @@ -579,7 +579,7 @@ }, { "cell_type": "code", - "execution_count": 88, + "execution_count": 257, "id": "1242122a-726e-4c37-a718-dd8e873d1612", "metadata": { "tags": [] @@ -637,7 +637,7 @@ }, { "cell_type": "code", - "execution_count": 89, + "execution_count": 258, "id": "cf1cf582-8831-4f83-bb17-2175afb193e8", "metadata": { "tags": [] @@ -652,7 +652,7 @@ "Name: count, dtype: int64" ] }, - "execution_count": 89, + "execution_count": 258, "metadata": {}, "output_type": "execute_result" } @@ -672,7 +672,7 @@ }, { "cell_type": "code", - "execution_count": 90, + "execution_count": 259, "id": "cc42cb08-275c-4b05-9d2b-77052da2f336", "metadata": { "tags": [] @@ -691,7 +691,7 @@ "dtype: int64" ] }, - "execution_count": 90, + "execution_count": 259, "metadata": {}, "output_type": "execute_result" } @@ -710,7 +710,7 @@ }, { "cell_type": "code", - "execution_count": 91, + "execution_count": 260, "id": "3c57d55d-afd6-467a-a7a8-ff04132770ed", "metadata": { "tags": [] @@ -729,7 +729,7 @@ "dtype: int64" ] }, - "execution_count": 91, + "execution_count": 260, "metadata": {}, "output_type": "execute_result" } @@ -752,7 +752,7 @@ }, { "cell_type": "code", - "execution_count": 92, + "execution_count": 261, "id": "2852c740", "metadata": {}, "outputs": [ @@ -798,7 +798,7 @@ }, { "cell_type": "code", - "execution_count": 93, + "execution_count": 262, "id": "707cc972", "metadata": {}, "outputs": [ @@ -846,7 +846,7 @@ }, { "cell_type": "code", - "execution_count": 94, + "execution_count": 263, "id": "3daf3ba1-d218-4ad4-b862-af679b91273f", "metadata": { "tags": [] @@ -926,7 +926,7 @@ "body_mass_g 640316.716388 " ] }, - "execution_count": 94, + "execution_count": 263, "metadata": {}, "output_type": "execute_result" } @@ -951,7 +951,7 @@ }, { "cell_type": "code", - "execution_count": 95, + "execution_count": 264, "id": "1d793e09-2cb9-47ff-a0e6-199a0f4fc1b3", "metadata": { "tags": [] @@ -1031,7 +1031,7 @@ "body_mass_g 1.000000 " ] }, - "execution_count": 95, + "execution_count": 264, "metadata": {}, "output_type": "execute_result" } @@ -1056,7 +1056,7 @@ }, { "cell_type": "code", - "execution_count": 96, + "execution_count": 265, "id": "1258c99d", "metadata": {}, "outputs": [ @@ -1096,7 +1096,7 @@ }, { "cell_type": "code", - "execution_count": 97, + "execution_count": 266, "id": "45b0a87f-028d-477f-9b65-199728c0b7ee", "metadata": { "tags": [] @@ -1150,7 +1150,7 @@ }, { "cell_type": "code", - "execution_count": 98, + "execution_count": 267, "id": "fb6ba7c0-1bd6-4fe5-8b7f-f6cbdfd3846c", "metadata": { "tags": [] @@ -1336,7 +1336,7 @@ }, { "cell_type": "code", - "execution_count": 99, + "execution_count": 268, "id": "d1f122a4-acff-4687-91b9-bfef13567d88", "metadata": { "tags": [] @@ -1347,7 +1347,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\n", - "\u001b[32m\u001b[32m\u001b[1m5 passed\u001b[0m\u001b[32m in 0.09s\u001b[0m\u001b[0m\n" + "\u001b[32m\u001b[32m\u001b[1m5 passed\u001b[0m\u001b[32m in 0.10s\u001b[0m\u001b[0m\n" ] } ], @@ -1453,7 +1453,7 @@ }, { "cell_type": "code", - "execution_count": 100, + "execution_count": 269, "id": "d88e9ccf", "metadata": {}, "outputs": [], @@ -1473,7 +1473,7 @@ }, { "cell_type": "code", - "execution_count": 101, + "execution_count": 270, "id": "331fe373", "metadata": {}, "outputs": [], @@ -1496,7 +1496,7 @@ }, { "cell_type": "code", - "execution_count": 102, + "execution_count": 271, "id": "3aa4471a", "metadata": {}, "outputs": [ @@ -1537,7 +1537,7 @@ }, { "cell_type": "code", - "execution_count": 103, + "execution_count": 272, "id": "cdbd9303", "metadata": { "tags": [] @@ -1615,7 +1615,7 @@ }, { "cell_type": "code", - "execution_count": 104, + "execution_count": 273, "id": "e140642a", "metadata": { "tags": [] @@ -1625,16 +1625,16 @@ "data": { "text/plain": [ "{'PipelineArn': 'arn:aws:sagemaker:us-east-1:325223348818:pipeline/session1-pipeline',\n", - " 'ResponseMetadata': {'RequestId': '885fb534-099d-4af5-b3f4-d511a68373c2',\n", + " 'ResponseMetadata': {'RequestId': '6919902a-84dc-468f-b035-b7546e66d149',\n", " 'HTTPStatusCode': 200,\n", - " 'HTTPHeaders': {'x-amzn-requestid': '885fb534-099d-4af5-b3f4-d511a68373c2',\n", + " 'HTTPHeaders': {'x-amzn-requestid': '6919902a-84dc-468f-b035-b7546e66d149',\n", " 'content-type': 'application/x-amz-json-1.1',\n", " 'content-length': '85',\n", - " 'date': 'Mon, 23 Oct 2023 15:47:13 GMT'},\n", + " 'date': 'Mon, 23 Oct 2023 19:12:00 GMT'},\n", " 'RetryAttempts': 0}}" ] }, - "execution_count": 104, + "execution_count": 273, "metadata": {}, "output_type": "execute_result" } @@ -1683,7 +1683,7 @@ }, { "cell_type": "code", - "execution_count": 105, + "execution_count": 274, "id": "59d1e634", "metadata": {}, "outputs": [], @@ -1739,7 +1739,7 @@ }, { "cell_type": "code", - "execution_count": 106, + "execution_count": 275, "id": "d92b121d-dcb9-43e8-9ee3-3ececb583e7e", "metadata": { "tags": [] @@ -1848,7 +1848,7 @@ }, { "cell_type": "code", - "execution_count": 107, + "execution_count": 276, "id": "14ea27ce-c453-4cb0-b309-dbecd732957e", "metadata": { "tags": [] @@ -1865,37 +1865,24 @@ "name": "stdout", "output_type": "stream", "text": [ - "8/8 - 0s - loss: 1.2884 - accuracy: 0.5230 - val_loss: 1.1704 - val_accuracy: 0.5490 - 218ms/epoch - 27ms/step\n" - ] - }, - { - "name": "stderr", - "output_type": "stream", - "text": [ - "WARNING:tensorflow:6 out of the last 11 calls to .predict_function at 0x31af753a0> triggered tf.function retracing. Tracing is expensive and the excessive number of tracings could be due to (1) creating @tf.function repeatedly in a loop, (2) passing tensors with different shapes, (3) passing Python objects instead of tensors. For (1), please define your @tf.function outside of the loop. For (2), @tf.function has reduce_retracing=True option that can avoid unnecessary retracing. For (3), please refer to https://www.tensorflow.org/guide/function#controlling_retracing and https://www.tensorflow.org/api_docs/python/tf/function for more details.\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "text": [ - "2/2 [==============================] - 0s 1ms/step\n" + "8/8 - 0s - loss: 0.8738 - accuracy: 0.7992 - val_loss: 0.8929 - val_accuracy: 0.7647 - 236ms/epoch - 29ms/step\n", + "2/2 [==============================] - 0s 2ms/step\n", + "Validation accuracy: 0.7647058823529411\n" ] }, { "name": "stderr", "output_type": "stream", "text": [ - "INFO:tensorflow:Assets written to: /var/folders/4c/v1q3hy1x4mb5w0wpc72zl3_w0000gp/T/tmp5ckp425a/model/001/assets\n" + "INFO:tensorflow:Assets written to: /var/folders/4c/v1q3hy1x4mb5w0wpc72zl3_w0000gp/T/tmp65a47aey/model/001/assets\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ - "Validation accuracy: 0.5490196078431373\n", "\u001b[32m.\u001b[0m\n", - "\u001b[32m\u001b[32m\u001b[1m1 passed\u001b[0m\u001b[32m in 0.49s\u001b[0m\u001b[0m\n" + "\u001b[32m\u001b[32m\u001b[1m1 passed\u001b[0m\u001b[32m in 0.53s\u001b[0m\u001b[0m\n" ] } ], @@ -1964,7 +1951,7 @@ }, { "cell_type": "code", - "execution_count": 108, + "execution_count": 277, "id": "90fe82ae-6a2c-4461-bc83-bb52d8871e3b", "metadata": { "tags": [] @@ -2020,7 +2007,7 @@ }, { "cell_type": "code", - "execution_count": 109, + "execution_count": 278, "id": "99e4850c-83d6-4f4e-a813-d5a3f4bb7486", "metadata": { "tags": [] @@ -2085,7 +2072,7 @@ }, { "cell_type": "code", - "execution_count": 110, + "execution_count": 279, "id": "f367d0e3", "metadata": {}, "outputs": [], @@ -2116,7 +2103,7 @@ }, { "cell_type": "code", - "execution_count": 111, + "execution_count": 280, "id": "c8c82750", "metadata": {}, "outputs": [], @@ -2147,7 +2134,7 @@ }, { "cell_type": "code", - "execution_count": 112, + "execution_count": 281, "id": "038ff2e5-ed28-445b-bc03-4e996ec2286f", "metadata": { "tags": [] @@ -2190,7 +2177,7 @@ }, { "cell_type": "code", - "execution_count": 113, + "execution_count": 282, "id": "9799ab39-fcae-41f4-a68b-85ab71b3ba9a", "metadata": { "tags": [] @@ -2228,16 +2215,16 @@ "data": { "text/plain": [ "{'PipelineArn': 'arn:aws:sagemaker:us-east-1:325223348818:pipeline/session2-pipeline',\n", - " 'ResponseMetadata': {'RequestId': '217c11ad-0e92-4e32-a1b3-e1c8cc6e8f82',\n", + " 'ResponseMetadata': {'RequestId': '5f3aa5bd-4c3c-490f-b216-41e952d718b8',\n", " 'HTTPStatusCode': 200,\n", - " 'HTTPHeaders': {'x-amzn-requestid': '217c11ad-0e92-4e32-a1b3-e1c8cc6e8f82',\n", + " 'HTTPHeaders': {'x-amzn-requestid': '5f3aa5bd-4c3c-490f-b216-41e952d718b8',\n", " 'content-type': 'application/x-amz-json-1.1',\n", " 'content-length': '85',\n", - " 'date': 'Mon, 23 Oct 2023 15:47:15 GMT'},\n", + " 'date': 'Mon, 23 Oct 2023 19:12:03 GMT'},\n", " 'RetryAttempts': 0}}" ] }, - "execution_count": 113, + "execution_count": 282, "metadata": {}, "output_type": "execute_result" } @@ -2282,7 +2269,7 @@ }, { "cell_type": "code", - "execution_count": 114, + "execution_count": 283, "id": "274a9b1e", "metadata": {}, "outputs": [], @@ -2340,7 +2327,7 @@ }, { "cell_type": "code", - "execution_count": 115, + "execution_count": 284, "id": "3ee3ab26-afa5-4ceb-9f7a-005d5fdea646", "metadata": { "tags": [] @@ -2426,7 +2413,7 @@ }, { "cell_type": "code", - "execution_count": 116, + "execution_count": 285, "id": "9a2540d8-278a-4953-bc54-0469d154427d", "metadata": { "tags": [] @@ -2436,24 +2423,23 @@ "name": "stderr", "output_type": "stream", "text": [ - "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", - "WARNING:tensorflow:5 out of the last 9 calls to .test_function at 0x316c00790> triggered tf.function retracing. Tracing is expensive and the excessive number of tracings could be due to (1) creating @tf.function repeatedly in a loop, (2) passing tensors with different shapes, (3) passing Python objects instead of tensors. For (1), please define your @tf.function outside of the loop. For (2), @tf.function has reduce_retracing=True option that can avoid unnecessary retracing. For (3), please refer to https://www.tensorflow.org/guide/function#controlling_retracing and https://www.tensorflow.org/api_docs/python/tf/function for more details.\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" ] }, { "name": "stdout", "output_type": "stream", "text": [ - "8/8 - 0s - loss: 1.0665 - accuracy: 0.4979 - val_loss: 1.0408 - val_accuracy: 0.5490 - 201ms/epoch - 25ms/step\n", + "8/8 - 0s - loss: 1.0332 - accuracy: 0.5272 - val_loss: 1.0559 - val_accuracy: 0.5294 - 232ms/epoch - 29ms/step\n", "2/2 [==============================] - 0s 2ms/step\n", - "Validation accuracy: 0.5490196078431373\n" + "Validation accuracy: 0.5294117647058824\n" ] }, { "name": "stderr", "output_type": "stream", "text": [ - "INFO:tensorflow:Assets written to: /var/folders/4c/v1q3hy1x4mb5w0wpc72zl3_w0000gp/T/tmpwon_erd4/model/001/assets\n", + "INFO:tensorflow:Assets written to: /var/folders/4c/v1q3hy1x4mb5w0wpc72zl3_w0000gp/T/tmpwl94wrqn/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" ] @@ -2463,7 +2449,7 @@ "output_type": "stream", "text": [ "2/2 [==============================] - 0s 2ms/step\n", - "Test accuracy: 0.5098039215686274\n", + "Test accuracy: 0.5686274509803921\n", "\u001b[32m.\u001b[0m" ] }, @@ -2471,16 +2457,15 @@ "name": "stderr", "output_type": "stream", "text": [ - "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", - "WARNING:tensorflow:6 out of the last 11 calls to .test_function at 0x317daa1f0> triggered tf.function retracing. Tracing is expensive and the excessive number of tracings could be due to (1) creating @tf.function repeatedly in a loop, (2) passing tensors with different shapes, (3) passing Python objects instead of tensors. For (1), please define your @tf.function outside of the loop. For (2), @tf.function has reduce_retracing=True option that can avoid unnecessary retracing. For (3), please refer to https://www.tensorflow.org/guide/function#controlling_retracing and https://www.tensorflow.org/api_docs/python/tf/function for more details.\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" ] }, { "name": "stdout", "output_type": "stream", "text": [ - "8/8 - 0s - loss: 1.0439 - accuracy: 0.3556 - val_loss: 1.0574 - val_accuracy: 0.3137 - 224ms/epoch - 28ms/step\n", - "2/2 [==============================] - 0s 1ms/step\n", + "8/8 - 0s - loss: 1.1213 - accuracy: 0.2887 - val_loss: 1.1126 - val_accuracy: 0.3137 - 234ms/epoch - 29ms/step\n", + "2/2 [==============================] - 0s 2ms/step\n", "Validation accuracy: 0.3137254901960784\n" ] }, @@ -2488,7 +2473,7 @@ "name": "stderr", "output_type": "stream", "text": [ - "INFO:tensorflow:Assets written to: /var/folders/4c/v1q3hy1x4mb5w0wpc72zl3_w0000gp/T/tmpv1zttgh2/model/001/assets\n", + "INFO:tensorflow:Assets written to: /var/folders/4c/v1q3hy1x4mb5w0wpc72zl3_w0000gp/T/tmp44v9gj0_/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" ] @@ -2497,10 +2482,10 @@ "name": "stdout", "output_type": "stream", "text": [ - "2/2 [==============================] - 0s 1ms/step\n", - "Test accuracy: 0.3137254901960784\n", + "2/2 [==============================] - 0s 2ms/step\n", + "Test accuracy: 0.37254901960784315\n", "\u001b[32m.\u001b[0m\n", - "\u001b[32m\u001b[32m\u001b[1m2 passed\u001b[0m\u001b[32m in 1.25s\u001b[0m\u001b[0m\n" + "\u001b[32m\u001b[32m\u001b[1m2 passed\u001b[0m\u001b[32m in 1.34s\u001b[0m\u001b[0m\n" ] } ], @@ -2584,7 +2569,7 @@ }, { "cell_type": "code", - "execution_count": 117, + "execution_count": 286, "id": "2fdff07f", "metadata": {}, "outputs": [ @@ -2624,7 +2609,7 @@ }, { "cell_type": "code", - "execution_count": 118, + "execution_count": 287, "id": "4f19e15b", "metadata": {}, "outputs": [], @@ -2645,7 +2630,7 @@ }, { "cell_type": "code", - "execution_count": 119, + "execution_count": 288, "id": "1f27b2ef", "metadata": {}, "outputs": [], @@ -2667,7 +2652,7 @@ }, { "cell_type": "code", - "execution_count": 120, + "execution_count": 289, "id": "48139a07-5c8e-4bc6-b666-bf9531f7f520", "metadata": { "tags": [] @@ -2734,7 +2719,7 @@ }, { "cell_type": "code", - "execution_count": 121, + "execution_count": 290, "id": "bb70f907", "metadata": {}, "outputs": [], @@ -2752,7 +2737,7 @@ }, { "cell_type": "code", - "execution_count": 122, + "execution_count": 291, "id": "4ca4cb61", "metadata": {}, "outputs": [], @@ -2778,7 +2763,7 @@ }, { "cell_type": "code", - "execution_count": 123, + "execution_count": 292, "id": "8c05a7e1", "metadata": {}, "outputs": [], @@ -2812,7 +2797,7 @@ }, { "cell_type": "code", - "execution_count": 124, + "execution_count": 293, "id": "c9773a4a", "metadata": { "tags": [] @@ -2873,7 +2858,7 @@ }, { "cell_type": "code", - "execution_count": 125, + "execution_count": 294, "id": "745486b5", "metadata": {}, "outputs": [], @@ -2893,7 +2878,7 @@ }, { "cell_type": "code", - "execution_count": 126, + "execution_count": 295, "id": "c4431bbf", "metadata": {}, "outputs": [], @@ -2922,7 +2907,7 @@ }, { "cell_type": "code", - "execution_count": 127, + "execution_count": 296, "id": "bebeecab", "metadata": {}, "outputs": [], @@ -2950,7 +2935,7 @@ }, { "cell_type": "code", - "execution_count": 128, + "execution_count": 297, "id": "36e2a2b1-6711-4266-95d8-d2aebd52e199", "metadata": { "tags": [] @@ -2979,7 +2964,7 @@ }, { "cell_type": "code", - "execution_count": 129, + "execution_count": 298, "id": "f70bcd33-b499-4e2b-953e-94d1ed96c10a", "metadata": { "tags": [] @@ -2996,6 +2981,7 @@ "name": "stdout", "output_type": "stream", "text": [ + "Using provided s3_resource\n", "Using provided s3_resource\n" ] }, @@ -3003,20 +2989,7 @@ "name": "stderr", "output_type": "stream", "text": [ - "INFO:sagemaker.processing:Uploaded None to s3://mlschool/session3-pipeline/code/09fea667a5ab7c37a068f22c00762d0b/sourcedir.tar.gz\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Using provided s3_resource\n" - ] - }, - { - "name": "stderr", - "output_type": "stream", - "text": [ + "INFO:sagemaker.processing:Uploaded None to s3://mlschool/session3-pipeline/code/09fea667a5ab7c37a068f22c00762d0b/sourcedir.tar.gz\n", "INFO:sagemaker.processing:runproc.sh uploaded to s3://mlschool/session3-pipeline/code/2c207c809cb0e0e9a1d77e5247f961f9/runproc.sh\n", "WARNING:sagemaker.workflow._utils:Popping out 'CertifyForMarketplace' from the pipeline definition since it will be overridden in pipeline execution time.\n" ] @@ -3048,16 +3021,16 @@ "data": { "text/plain": [ "{'PipelineArn': 'arn:aws:sagemaker:us-east-1:325223348818:pipeline/session3-pipeline',\n", - " 'ResponseMetadata': {'RequestId': '2c887422-afbc-4c61-893a-88a069720aab',\n", + " 'ResponseMetadata': {'RequestId': '18bcbbca-b314-44d5-8bd4-70ac1f63c2cf',\n", " 'HTTPStatusCode': 200,\n", - " 'HTTPHeaders': {'x-amzn-requestid': '2c887422-afbc-4c61-893a-88a069720aab',\n", + " 'HTTPHeaders': {'x-amzn-requestid': '18bcbbca-b314-44d5-8bd4-70ac1f63c2cf',\n", " 'content-type': 'application/x-amz-json-1.1',\n", " 'content-length': '85',\n", - " 'date': 'Mon, 23 Oct 2023 15:47:19 GMT'},\n", + " 'date': 'Mon, 23 Oct 2023 19:12:06 GMT'},\n", " 'RetryAttempts': 0}}" ] }, - "execution_count": 129, + "execution_count": 298, "metadata": {}, "output_type": "execute_result" } @@ -3104,7 +3077,7 @@ }, { "cell_type": "code", - "execution_count": 130, + "execution_count": 299, "id": "f3b4126e", "metadata": {}, "outputs": [], @@ -3162,7 +3135,7 @@ }, { "cell_type": "code", - "execution_count": 131, + "execution_count": 300, "id": "2a116f93", "metadata": {}, "outputs": [], @@ -3182,7 +3155,7 @@ }, { "cell_type": "code", - "execution_count": 132, + "execution_count": 301, "id": "87437a26-e9ea-4866-9dc3-630444c0fb46", "metadata": { "tags": [] @@ -3199,7 +3172,7 @@ " 'ModelApprovalStatus': 'Approved'}" ] }, - "execution_count": 132, + "execution_count": 301, "metadata": {}, "output_type": "execute_result" } @@ -3230,7 +3203,7 @@ }, { "cell_type": "code", - "execution_count": 133, + "execution_count": 302, "id": "dee516e9", "metadata": {}, "outputs": [], @@ -3266,12 +3239,29 @@ }, { "cell_type": "code", - "execution_count": 134, + "execution_count": 303, "id": "7c8852d5-818a-406c-944d-30bf6de90288", "metadata": { "tags": [] }, - "outputs": [], + "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "INFO:sagemaker:Creating model with name: penguins-2023-10-23-19-14-04-732\n", + "INFO:sagemaker:Creating endpoint-config with name penguins-endpoint\n", + "INFO:sagemaker:Creating endpoint with name penguins-endpoint\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "text": [ + "---!" + ] + } + ], "source": [ "%%script false --no-raise-error\n", "#| eval: false\n", @@ -3297,7 +3287,7 @@ }, { "cell_type": "code", - "execution_count": 135, + "execution_count": 304, "id": "ba7da291", "metadata": {}, "outputs": [], @@ -3331,12 +3321,40 @@ }, { "cell_type": "code", - "execution_count": 136, + "execution_count": 305, "id": "0817a25e-8224-4911-830b-d659e7458b4a", "metadata": { "tags": [] }, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "{\n", + " \"predictions\": [\n", + " [\n", + " 0.00874690246,\n", + " 0.0456074178,\n", + " 0.94564569\n", + " ],\n", + " [\n", + " 0.77917105,\n", + " 0.0874738544,\n", + " 0.133355066\n", + " ],\n", + " [\n", + " 0.933188081,\n", + " 0.0207268894,\n", + " 0.0460849963\n", + " ]\n", + " ]\n", + "}\n", + "\n", + "Species: [2 0 0]\n" + ] + } + ], "source": [ "%%script false --no-raise-error\n", "#| eval: false\n", @@ -3371,12 +3389,21 @@ }, { "cell_type": "code", - "execution_count": 137, + "execution_count": 306, "id": "6b32c3a4-312e-473c-a217-33606f77d1e9", "metadata": { "tags": [] }, - "outputs": [], + "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "INFO:sagemaker:Deleting endpoint configuration with name: penguins-endpoint\n", + "INFO:sagemaker:Deleting endpoint with name: penguins-endpoint\n" + ] + } + ], "source": [ "%%script false --no-raise-error\n", "#| eval: false\n", @@ -3810,7 +3837,7 @@ " \n", " predictions = np.argmax(input_data, axis=-1)\n", " confidence = np.max(input_data, axis=-1)\n", - " return [(confidence, model[prediction]) for confidence, prediction in zip(confidence, predictions)]\n", + " return [(model[prediction], confidence) for confidence, prediction in zip(confidence, predictions)]\n", "\n", "\n", "def model_fn(model_dir):\n", @@ -4688,12 +4715,20 @@ }, { "cell_type": "code", - "execution_count": 159, + "execution_count": 308, "id": "3cc966fb-b611-417f-a8b8-0c5d2f95252c", "metadata": { "tags": [] }, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "[{\"prediction\": 0.971010566, \"confidence\": \"Adelie\"}, {\"prediction\": 0.931603611, \"confidence\": \"Adelie\"}, {\"prediction\": 0.933561683, \"confidence\": \"Adelie\"}]\n" + ] + } + ], "source": [ "%%script false --no-raise-error\n", "#| eval: false\n", @@ -4738,12 +4773,21 @@ }, { "cell_type": "code", - "execution_count": 160, + "execution_count": 309, "id": "8c3e851a-2416-4a0b-b8a1-c483cde3d776", "metadata": { "tags": [] }, - "outputs": [], + "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "INFO:sagemaker:Deleting endpoint configuration with name: penguins-endpoint-config-1023194943\n", + "INFO:sagemaker:Deleting endpoint with name: penguins-endpoint\n" + ] + } + ], "source": [ "%%script false --no-raise-error\n", "#| eval: false\n",