diff --git a/examples/model-selection/debug.ipynb b/examples/model-selection/debug.ipynb new file mode 100644 index 0000000..b723173 --- /dev/null +++ b/examples/model-selection/debug.ipynb @@ -0,0 +1,397 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": 1, + "id": "f40ac1dc-7271-45bb-ae44-9112faffdebd", + "metadata": {}, + "outputs": [], + "source": [ + "%load_ext autoreload\n", + "%autoreload 2" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "id": "a4dad677-2266-4bd3-bdd3-a95eeae0e1a6", + "metadata": {}, + "outputs": [], + "source": [ + "from metaflow import Metaflow, Flow, Run, Step\n", + "import common" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "id": "4bd73f5c-7e06-4248-8401-2248b6329fc2", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "/Users/fwhigh/repos/metaflow-helper/examples/model-selection\n" + ] + } + ], + "source": [ + "!pwd" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "id": "b7bb5881-9af4-4006-985b-55bbb7a5b2e6", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "[Flow('Train')]\n" + ] + } + ], + "source": [ + "print(Metaflow().flows)\n" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "id": "e695fa83-b14e-4823-9fcd-cf5faee1e936", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "[Run('Train/1621360258148759'), Run('Train/1621360113161437')]\n", + "1621360258148759\n" + ] + } + ], + "source": [ + "# These are the class names of your flow specs\n", + "flow_map = {'TRAIN': 'Train', 'PREDICT': 'Predict'}\n", + "# Pick one to debug in this notebook\n", + "debug_key = 'TRAIN'\n", + "# What step are you debugging?\n", + "debug_step_name = 'foreach_fold'\n", + "# What artifact are you looking at?\n", + "debug_artifact_name = ''\n", + "flow = Flow(flow_map[debug_key])\n", + "print(list(flow))\n", + "# What run ID?\n", + "run_id = list(flow)[0].id # Get the latest run ID\n", + "#run_id = '1621360113161437' # Or fully qualify the run ID if you know it\n", + "print(run_id)" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "id": "b156008c-d51a-4f2e-a085-827be179d671", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "" + ] + }, + "execution_count": 6, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "data = list(Step(f'{flow_map[debug_key]}/{run_id}/{debug_step_name}'))[0].data\n", + "data" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "id": "a73767ef-7a8e-4e28-85ed-7b05c7d62075", + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
targetnum_0num_1num_2num_3num_4num_5num_6num_7num_8num_9cat
0-218.8537660.396007-1.0930620.539249-0.769916-0.208299-0.635846-0.6743330.5765910.6764330.031831type_0
1188.8154121.849591-0.2141670.265688-0.4513030.0192790.7199840.723100-0.101697-1.1029060.024612type_0
2122.535122-0.8525860.0229600.645055-0.5324901.6819220.4683851.011842-0.6677131.735879-0.657951type_0
3-25.764331-0.370704-0.945616-2.3205940.286904-1.3183960.2256090.317161-0.0672760.4497120.520041type_0
4-467.0036390.352817-0.152774-1.401347-0.817493-0.263937-1.2266221.030438-0.0553530.967446-2.047324type_0
.......................................
95-723.943434-0.5352700.025405-1.153950-2.582797-0.406072-1.032643-0.347962-1.642965-0.436748-1.353389type_0
962.1678961.4665790.852552-0.2226750.5672901.141102-0.291837-0.3534320.857924-0.761492-1.616474type_0
97-386.0929040.115148-0.3791480.417319-1.550429-1.660700-1.405963-0.944368-0.110489-0.5900580.238103type_0
98-203.314236-0.387327-0.3023030.3781630.1549471.202380-0.347912-0.8877861.2302910.156349-1.980796type_0
99181.612333-0.1310541.133080-1.8297400.453782-1.1183120.5898800.037006-0.805627-0.3638590.767902type_0
\n", + "

100 rows × 12 columns

\n", + "
" + ], + "text/plain": [ + " target num_0 num_1 num_2 num_3 num_4 num_5 \\\n", + "0 -218.853766 0.396007 -1.093062 0.539249 -0.769916 -0.208299 -0.635846 \n", + "1 188.815412 1.849591 -0.214167 0.265688 -0.451303 0.019279 0.719984 \n", + "2 122.535122 -0.852586 0.022960 0.645055 -0.532490 1.681922 0.468385 \n", + "3 -25.764331 -0.370704 -0.945616 -2.320594 0.286904 -1.318396 0.225609 \n", + "4 -467.003639 0.352817 -0.152774 -1.401347 -0.817493 -0.263937 -1.226622 \n", + ".. ... ... ... ... ... ... ... \n", + "95 -723.943434 -0.535270 0.025405 -1.153950 -2.582797 -0.406072 -1.032643 \n", + "96 2.167896 1.466579 0.852552 -0.222675 0.567290 1.141102 -0.291837 \n", + "97 -386.092904 0.115148 -0.379148 0.417319 -1.550429 -1.660700 -1.405963 \n", + "98 -203.314236 -0.387327 -0.302303 0.378163 0.154947 1.202380 -0.347912 \n", + "99 181.612333 -0.131054 1.133080 -1.829740 0.453782 -1.118312 0.589880 \n", + "\n", + " num_6 num_7 num_8 num_9 cat \n", + "0 -0.674333 0.576591 0.676433 0.031831 type_0 \n", + "1 0.723100 -0.101697 -1.102906 0.024612 type_0 \n", + "2 1.011842 -0.667713 1.735879 -0.657951 type_0 \n", + "3 0.317161 -0.067276 0.449712 0.520041 type_0 \n", + "4 1.030438 -0.055353 0.967446 -2.047324 type_0 \n", + ".. ... ... ... ... ... \n", + "95 -0.347962 -1.642965 -0.436748 -1.353389 type_0 \n", + "96 -0.353432 0.857924 -0.761492 -1.616474 type_0 \n", + "97 -0.944368 -0.110489 -0.590058 0.238103 type_0 \n", + "98 -0.887786 1.230291 0.156349 -1.980796 type_0 \n", + "99 0.037006 -0.805627 -0.363859 0.767902 type_0 \n", + "\n", + "[100 rows x 12 columns]" + ] + }, + "execution_count": 7, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "df = data.df\n", + "df" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "14263569-96bc-47d8-b702-95cf1bd44325", + "metadata": {}, + "outputs": [], + "source": [] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.7.10" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +}