From b39712dc80742642d519f54da6524a1143bdfa5a Mon Sep 17 00:00:00 2001 From: Ryan Soley Date: Wed, 1 May 2024 13:28:20 -0400 Subject: [PATCH] update notebook example --- notebooks/logging-examples/tagging.ipynb | 107 ++++++++++++++--------- 1 file changed, 68 insertions(+), 39 deletions(-) diff --git a/notebooks/logging-examples/tagging.ipynb b/notebooks/logging-examples/tagging.ipynb index 5c444e40..fcd24f21 100644 --- a/notebooks/logging-examples/tagging.ipynb +++ b/notebooks/logging-examples/tagging.ipynb @@ -50,15 +50,15 @@ "name": "stdout", "output_type": "stream", "text": [ - "`experiment_a` ID: 2e23d721-b58e-44b3-b53a-7889319425ea, tags: ['tag_a']\n", - "`experiment_b` ID: 1f573c46-8e82-4fa4-a560-6bd92778b882, tags: ['tag_b']\n", - "`experiment_c` ID: 85580996-fa26-49c4-b4ec-fb015c1f517c, tags: ['tag_a', 'tag_b']\n" + "`experiment_a` ID: 7e08c0bf-7f88-46d1-89de-4e0da7e2a448, tags: ['tag_a']\n", + "`experiment_b` ID: 75e54061-5910-43a0-a036-c5a6bdd77ca1, tags: ['other_tag_a', 'tag_b']\n", + "`experiment_c` ID: cc09ea5c-18df-48b1-888e-e692f5d9e71a, tags: ['tag_a', 'tag_b']\n" ] } ], "source": [ "experiment_a = project.log_experiment(tags=[\"tag_a\"])\n", - "experiment_b = project.log_experiment(tags=[\"tag_b\"])\n", + "experiment_b = project.log_experiment(tags=[\"other_tag_a\", \"tag_b\"])\n", "experiment_c = project.log_experiment(tags=[\"tag_a\", \"tag_b\"])\n", "\n", "print(f\"`experiment_a` ID: {experiment_a.id}, tags: {experiment_a.tags}\")\n", @@ -116,8 +116,8 @@ { "data": { "text/plain": [ - "['2e23d721-b58e-44b3-b53a-7889319425ea',\n", - " '85580996-fa26-49c4-b4ec-fb015c1f517c']" + "[\"7e08c0bf-7f88-46d1-89de-4e0da7e2a448: ['tag_a']\",\n", + " \"cc09ea5c-18df-48b1-888e-e692f5d9e71a: ['tag_a', 'tag_b']\"]" ] }, "execution_count": 4, @@ -126,7 +126,7 @@ } ], "source": [ - "[e.id for e in project.experiments(tags=[\"tag_a\"])]" + "[f\"{e.id}: {e.tags}\" for e in project.experiments(tags=[\"tag_a\"])]" ] }, { @@ -147,8 +147,8 @@ { "data": { "text/plain": [ - "['1f573c46-8e82-4fa4-a560-6bd92778b882',\n", - " '85580996-fa26-49c4-b4ec-fb015c1f517c']" + "[\"75e54061-5910-43a0-a036-c5a6bdd77ca1: ['other_tag_a', 'tag_b']\",\n", + " \"cc09ea5c-18df-48b1-888e-e692f5d9e71a: ['tag_a', 'tag_b']\"]" ] }, "execution_count": 5, @@ -157,7 +157,7 @@ } ], "source": [ - "[e.id for e in project.experiments(tags=[\"tag_b\"])]" + "[f\"{e.id}: {e.tags}\" for e in project.experiments(tags=[\"tag_b\"])]" ] }, { @@ -177,9 +177,9 @@ { "data": { "text/plain": [ - "['2e23d721-b58e-44b3-b53a-7889319425ea',\n", - " '1f573c46-8e82-4fa4-a560-6bd92778b882',\n", - " '85580996-fa26-49c4-b4ec-fb015c1f517c']" + "[\"7e08c0bf-7f88-46d1-89de-4e0da7e2a448: ['tag_a']\",\n", + " \"75e54061-5910-43a0-a036-c5a6bdd77ca1: ['other_tag_a', 'tag_b']\",\n", + " \"cc09ea5c-18df-48b1-888e-e692f5d9e71a: ['tag_a', 'tag_b']\"]" ] }, "execution_count": 6, @@ -188,7 +188,7 @@ } ], "source": [ - "[e.id for e in project.experiments(tags=[\"tag_a\", \"tag_b\"])]" + "[f\"{e.id}: {e.tags}\" for e in project.experiments(tags=[\"tag_a\", \"tag_b\"])]" ] }, { @@ -208,7 +208,7 @@ { "data": { "text/plain": [ - "['85580996-fa26-49c4-b4ec-fb015c1f517c']" + "[\"cc09ea5c-18df-48b1-888e-e692f5d9e71a: ['tag_a', 'tag_b']\"]" ] }, "execution_count": 7, @@ -217,7 +217,7 @@ } ], "source": [ - "[e.id for e in project.experiments(tags=[\"tag_a\", \"tag_b\"], qtype=\"and\")]" + "[f\"{e.id}: {e.tags}\" for e in project.experiments(tags=[\"tag_a\", \"tag_b\"], qtype=\"and\")]" ] }, { @@ -239,8 +239,9 @@ { "data": { "text/plain": [ - "[\"2e23d721-b58e-44b3-b53a-7889319425ea: ['tag_a']\",\n", - " \"85580996-fa26-49c4-b4ec-fb015c1f517c: ['tag_a', 'tag_b']\"]" + "[\"7e08c0bf-7f88-46d1-89de-4e0da7e2a448: ['tag_a']\",\n", + " \"75e54061-5910-43a0-a036-c5a6bdd77ca1: ['other_tag_a', 'tag_b']\",\n", + " \"cc09ea5c-18df-48b1-888e-e692f5d9e71a: ['tag_a', 'tag_b']\"]" ] }, "execution_count": 8, @@ -270,9 +271,7 @@ { "data": { "text/plain": [ - "[\"2e23d721-b58e-44b3-b53a-7889319425ea: ['tag_a']\",\n", - " \"1f573c46-8e82-4fa4-a560-6bd92778b882: ['tag_b']\",\n", - " \"85580996-fa26-49c4-b4ec-fb015c1f517c: ['tag_a', 'tag_b']\"]" + "[\"75e54061-5910-43a0-a036-c5a6bdd77ca1: ['other_tag_a', 'tag_b']\"]" ] }, "execution_count": 9, @@ -281,7 +280,7 @@ } ], "source": [ - "[f\"{e.id}: {e.tags}\" for e in project.experiments(tags=[\"*_*\"])]" + "[f\"{e.id}: {e.tags}\" for e in project.experiments(tags=[\"*_*_*\"])]" ] }, { @@ -333,7 +332,7 @@ { "data": { "text/plain": [ - "['tag_i', 'tag_h', 'tag_a', 'tag_b']" + "['tag_i', 'tag_h', 'tag_b', 'tag_a']" ] }, "execution_count": 11, @@ -402,7 +401,7 @@ } ], "source": [ - "[e.id for e in project.experiments(tags=[\"tag_a\", \"tag_b\"], qtype=\"and\")]" + "[f\"{e.id}: {e.tags}\" for e in project.experiments(tags=[\"tag_a\", \"tag_b\"], qtype=\"and\")]" ] }, { @@ -423,7 +422,7 @@ "outputs": [], "source": [ "experiment_d = project.log_experiment(tags=[\"tag_j:k\"])\n", - "experiment_e = project.log_experiment(tags=[\"tag_l:m\", \"tag_l:n\"])" + "experiment_e = project.log_experiment(tags=[\"tag_j:l\", \"tag_m:n\", \"tag_m:o\"])" ] }, { @@ -503,7 +502,7 @@ { "data": { "text/plain": [ - "['m', 'n']" + "['n', 'o']" ] }, "execution_count": 17, @@ -512,7 +511,37 @@ } ], "source": [ - "experiment_e.tags[\"tag_l\"]" + "experiment_e.tags[\"tag_m\"]" + ] + }, + { + "cell_type": "markdown", + "id": "a85a3307-eb62-4bd1-b0eb-9367f6edf164", + "metadata": {}, + "source": [ + "Combine key-value tags and wildcards to examine the value of _\"tag_j\"_ on every experiment that has one." + ] + }, + { + "cell_type": "code", + "execution_count": 18, + "id": "334e5096-b816-4981-b6c2-6e741a323a3e", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "['0962a69f-1db5-4f42-884c-60ad179bdb5c: k',\n", + " 'd5c9d775-e546-4b02-93ac-f5cee6d17aea: l']" + ] + }, + "execution_count": 18, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "[f\"{e.id}: {e.tags['tag_j']}\" for e in project.experiments(tags=[\"tag_j:*\"])]" ] }, { @@ -528,19 +557,19 @@ }, { "cell_type": "code", - "execution_count": 18, + "execution_count": 19, "id": "ab2c5a29-b8ee-45e7-b4b9-6dc22c3abdd7", "metadata": {}, "outputs": [ { "data": { "text/plain": [ - "['child:a0260c5a-a0e5-4a90-8667-514795a9c329',\n", - " 'child:8dc5ecb3-368f-42ea-b444-b49d997045a3',\n", + "['child:0962a69f-1db5-4f42-884c-60ad179bdb5c',\n", + " 'child:d5c9d775-e546-4b02-93ac-f5cee6d17aea',\n", " 'tag_a']" ] }, - "execution_count": 18, + "execution_count": 19, "metadata": {}, "output_type": "execute_result" } @@ -564,18 +593,18 @@ }, { "cell_type": "code", - "execution_count": 19, + "execution_count": 20, "id": "b3c04d92-6f52-4c19-ab0e-6907b4f8ab17", "metadata": {}, "outputs": [ { "data": { "text/plain": [ - "['a0260c5a-a0e5-4a90-8667-514795a9c329',\n", - " '8dc5ecb3-368f-42ea-b444-b49d997045a3']" + "['0962a69f-1db5-4f42-884c-60ad179bdb5c',\n", + " 'd5c9d775-e546-4b02-93ac-f5cee6d17aea']" ] }, - "execution_count": 19, + "execution_count": 20, "metadata": {}, "output_type": "execute_result" } @@ -594,18 +623,18 @@ }, { "cell_type": "code", - "execution_count": 20, + "execution_count": 21, "id": "876a3358-2277-47b4-910f-1a1db89bda9d", "metadata": {}, "outputs": [ { "data": { "text/plain": [ - "[,\n", - " ]" + "[,\n", + " ]" ] }, - "execution_count": 20, + "execution_count": 21, "metadata": {}, "output_type": "execute_result" }