From 70403f67b3583475314c84e22d7b7f0c86f758dd Mon Sep 17 00:00:00 2001 From: Jake Kolessar Date: Fri, 5 Aug 2022 22:42:00 -0400 Subject: [PATCH 1/2] Notebook updated to be Colab compatible --- ...RTHQ_newTFTv29-gregor-parameters-fig.ipynb | 3067 +++++++++++------ 1 file changed, 1931 insertions(+), 1136 deletions(-) diff --git a/benchmarks/earthquake/latest/FFFFWNPFEARTHQ_newTFTv29-gregor-parameters-fig.ipynb b/benchmarks/earthquake/latest/FFFFWNPFEARTHQ_newTFTv29-gregor-parameters-fig.ipynb index ddadd0f8..849e1e75 100644 --- a/benchmarks/earthquake/latest/FFFFWNPFEARTHQ_newTFTv29-gregor-parameters-fig.ipynb +++ b/benchmarks/earthquake/latest/FFFFWNPFEARTHQ_newTFTv29-gregor-parameters-fig.ipynb @@ -16,6 +16,11 @@ "cell_type": "code", "execution_count": null, "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "QhiCvEf4XLWm", + "outputId": "938374b4-6cc3-4ae5-a7e3-07e6612715b0", "pycharm": { "name": "#%%\n" } @@ -54,12 +59,64 @@ { "cell_type": "code", "execution_count": null, + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "Ias7oj-GXPLr", + "outputId": "ff022f26-0e33-4605-deeb-0393074e73e0" + }, + "outputs": [], + "source": [ + "import sys\n", + "in_colab = 'google.colab' in sys.modules\n", + "\n", + "if not 'cloudmesh' in sys.modules and in_colab:\n", + " !pip install cloudmesh-common\n", + " !pip install cloudmesh-gpu\n", + " !pip install ipython-autotime\n", + " !pip install git+https://github.com/mlperf/logging.git@1.0.0\n", + "\n", + "if in_colab:\n", + " # Avoids scroll-in-the-scroll in the entire Notebook\n", + " #test\n", + " from IPython.display import Javascript\n", + " def resize_colab_cell():\n", + " display(Javascript('google.colab.output.setIframeHeight(0, true, {maxHeight: 20000})'))\n", + " get_ipython().events.register('pre_run_cell', resize_colab_cell)\n", + "\n", + " from google.colab import drive\n", + " drive.mount('/content/gdrive')\n", + "\n", + " # configure for Colab\n", + " !wget --no-check-certificate --content-disposition https://raw.githubusercontent.com/laszewsk/mlcommons/main/benchmarks/earthquake/latest/experiments/rivanna-2epoch/rivanna-2epoch.yaml\n", + " !mv rivanna-2epoch.yaml config.yaml\n", + " !echo 'system.host: colab' >> config.yaml\n", + " #!mkdir ColabDatasets/\n", + " #!cd /content/gdrive/MyDrive/ColabDatasets/\n", + " !git clone https://github.com/laszewsk/mlcommons-data-earthquake.git mlcommons-data-earthquake\n", + " !tar Jxvf mlcommons-data-earthquake/data.tar.xz -C ." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/", + "height": 1126 + }, + "id": "XoCQkcwlXLWn", + "outputId": "8918b712-bc52-445e-ea3a-4119be4f2639", + "pycharm": { + "name": "#%%\n" + } + }, "outputs": [], "source": [ "from cloudmesh.common.util import banner\n", "\n", "import os\n", - "import sys\n", "import pwd\n", "import socket\n", "import pathlib\n", @@ -74,7 +131,6 @@ "\n", "from cloudmesh.gpu.gpu import Gpu\n", "from pprint import pprint\n", - "import sys\n", "\n", "from IPython.display import display\n", "import tensorflow_datasets as tfds\n", @@ -161,8 +217,6 @@ "config.update(program_config)\n", "print(Printer.attribute(config))\n", "\n", - "in_colab = 'google.colab' in sys.modules\n", - "\n", "in_rivanna = config[\"system.host\"] == \"rivanna\"\n", "#in_rivanna = \"hpc.virginia.edu\" in socket.getfqdn()\n", "\n", @@ -175,35 +229,28 @@ "else:\n", " colortheme = True\n", "\n", - "\n", - "if in_colab:\n", - " # Avoids scroll-in-the-scroll in the entire Notebook\n", - " #test\n", - " from IPython.display import Javascript\n", - " def resize_colab_cell():\n", - " display(Javascript('google.colab.output.setIframeHeight(0, true, {maxHeight: 20000})'))\n", - " get_ipython().events.register('pre_run_cell', resize_colab_cell)\n", - "\n", - " from google.colab import drive\n", - " drive.mount('/content/gdrive')\n", - "\n", - "if in_rivanna or gregor or in_ubuntu or in_dgxstation or in_summit:\n", + "if in_rivanna or gregor or in_ubuntu or in_dgxstation or in_summit or (gregor and in_colab):\n", " tf.config.set_soft_device_placement(config.set_soft_device_placement)\n", " tf.debugging.set_log_device_placement(config.debugging_set_log_device_placement)\n", "\n", "\n", "# tf.test.is_gpu_available\n" - ], - "metadata": { - "collapsed": false, - "pycharm": { - "name": "#%%\n" - } - } + ] }, { "cell_type": "code", "execution_count": null, + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/", + "height": 35 + }, + "id": "OoeRrSAiXLWo", + "outputId": "787ecd9e-2aa3-416b-bc55-8e1e3b2fd25e", + "pycharm": { + "name": "#%%\n" + } + }, "outputs": [], "source": [ "def TIME_start(name, mllog_key=\"BLOCK_START\", **kwargs):\n", @@ -229,17 +276,22 @@ "# t = StopWatch.get(name)\n", "# h = humanize.naturaldelta(timedelta(seconds=t))\n", "# banner(f\"Stop timer {name}: {t}s or {h}\")\n" - ], - "metadata": { - "collapsed": false, - "pycharm": { - "name": "#%%\n" - } - } + ] }, { "cell_type": "code", "execution_count": null, + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/", + "height": 981 + }, + "id": "7Z8R3calXLWp", + "outputId": "fb0240bd-b170-402a-831d-19244b5d5e53", + "pycharm": { + "name": "#%%\n" + } + }, "outputs": [], "source": [ "# who am i\n", @@ -252,43 +304,41 @@ " print(\"The command is not on your path.\")\n", "\n", "print(Printer.attribute(config))" - ], - "metadata": { - "collapsed": false, - "pycharm": { - "name": "#%%\n" - } - } + ] }, { "cell_type": "code", "execution_count": null, - "outputs": [], - "source": [ - "StopWatch.benchmark()" - ], "metadata": { - "collapsed": false, + "colab": { + "base_uri": "https://localhost:8080/", + "height": 1055 + }, + "id": "zWCEwQyEXLWp", + "outputId": "7aaf61d5-0858-4bb5-bad4-e9a8c8610ca5", "pycharm": { "name": "#%%\n" } - } + }, + "outputs": [], + "source": [ + "StopWatch.benchmark()" + ] }, { "cell_type": "code", "execution_count": null, - "outputs": [], - "source": [], "metadata": { - "collapsed": false, + "colab": { + "base_uri": "https://localhost:8080/", + "height": 1053 + }, + "id": "a2ohhjaQXLWq", + "outputId": "9902e1e8-82ec-4f72-efc5-68ff7ee6188f", "pycharm": { "name": "#%%\n" } - } - }, - { - "cell_type": "code", - "execution_count": null, + }, "outputs": [], "source": [ "r = Gpu().system()\n", @@ -301,17 +351,22 @@ " pass\n", "\n", "print (Printer.attribute(config))" - ], - "metadata": { - "collapsed": false, - "pycharm": { - "name": "#%%\n" - } - } + ] }, { "cell_type": "code", "execution_count": null, + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/", + "height": 35 + }, + "id": "gs5EhvM4XLWq", + "outputId": "277ea152-111b-4994-ebf1-84955fce3b39", + "pycharm": { + "name": "#%%\n" + } + }, "outputs": [], "source": [ "%matplotlib inline\n", @@ -339,17 +394,22 @@ " bbox = Bbox.union([item.get_window_extent() for item in items])\n", "\n", " return bbox.expanded(1.0 + pad, 1.0 + pad)" - ], - "metadata": { - "collapsed": false, - "pycharm": { - "name": "#%%\n" - } - } + ] }, { "cell_type": "code", "execution_count": null, + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/", + "height": 71 + }, + "id": "Py_nlCeIXLWr", + "outputId": "41819e1c-1a1c-4c83-d220-11760568c2f3", + "pycharm": { + "name": "#%%\n" + } + }, "outputs": [], "source": [ "# Set Runname\n", @@ -364,29 +424,34 @@ "print(f'Your runtime has {memory} of available RAM\\n')\n", "\n", "config.runname = RunName" - ], - "metadata": { - "collapsed": false, - "pycharm": { - "name": "#%%\n" - } - } + ] }, { "cell_type": "markdown", - "source": [ - "# Initial System Code" - ], "metadata": { - "collapsed": false, + "id": "feBiWO2mXLWr", "pycharm": { "name": "#%% md\n" } - } + }, + "source": [ + "# Initial System Code" + ] }, { "cell_type": "code", "execution_count": null, + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/", + "height": 1073 + }, + "id": "ckFZPAbaXLWr", + "outputId": "9def04f4-b175-4d23-f34e-4448283584af", + "pycharm": { + "name": "#%%\n" + } + }, "outputs": [], "source": [ "TIME_start(\"INIT\", mllog_key=\"INIT_START\")\n", @@ -408,17 +473,22 @@ "banner(\"System information\")\n", "r = StopWatch.systeminfo()\n", "print (r)" - ], - "metadata": { - "collapsed": false, - "pycharm": { - "name": "#%%\n" - } - } + ] }, { "cell_type": "code", "execution_count": null, + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/", + "height": 499 + }, + "id": "e5EIJCB0XLWr", + "outputId": "04151b82-c726-471d-f82a-f2c3c2c5b25b", + "pycharm": { + "name": "#%%\n" + } + }, "outputs": [], "source": [ "\n", @@ -429,28 +499,28 @@ "else:\n", " print(gpu_info)\n", "\n" - ], - "metadata": { - "collapsed": false, - "pycharm": { - "name": "#%%\n" - } - } + ] }, { "cell_type": "markdown", - "source": [ - "# Transformer model for science data based on original for language understanding" - ], "metadata": { - "collapsed": false, + "id": "ZCfXGubDXLWs", "pycharm": { "name": "#%% md\n" } - } + }, + "source": [ + "# Transformer model for science data based on original for language understanding" + ] }, { "cell_type": "markdown", + "metadata": { + "id": "dLAvW2NrXLWs", + "pycharm": { + "name": "#%% md\n" + } + }, "source": [ "\n", " \n", "
\n", @@ -472,28 +542,28 @@ " Download notebook\n", "
" - ], + ] + }, + { + "cell_type": "markdown", "metadata": { - "collapsed": false, + "id": "9q2ZtO7lXLWs", "pycharm": { "name": "#%% md\n" } - } + }, + "source": [ + "## Science Data Parameters and Sizes" + ] }, { "cell_type": "markdown", - "source": [ - "## Science Data Parameters and Sizes" - ], "metadata": { - "collapsed": false, + "id": "YhcMd7hOXLWs", "pycharm": { "name": "#%% md\n" } - } - }, - { - "cell_type": "markdown", + }, "source": [ "-------\n", "Here is structure of science time series module. We will need several arrays that will need to be flattened at times. Note Python defaults to row major i.e. final index describes contiguous positions in memory\n", @@ -559,28 +629,28 @@ "\n", "\n", "\n" - ], + ] + }, + { + "cell_type": "markdown", "metadata": { - "collapsed": false, + "id": "J3TJ5sYOXLWs", "pycharm": { "name": "#%% md\n" } - } + }, + "source": [ + "## Science Data Arrays" + ] }, { "cell_type": "markdown", - "source": [ - "## Science Data Arrays" - ], "metadata": { - "collapsed": false, + "id": "WkQHshekXLWs", "pycharm": { "name": "#%% md\n" } - } - }, - { - "cell_type": "markdown", + }, "source": [ "Typical Arrays\n", "\n", @@ -601,16 +671,16 @@ "Output Features are [ ipred = 0 ..Npred-1 ] [ iforecast = 0 ..Nforecast-1 ]\n", "\n", "Input Features are static fields followed by if present by dynamic system fields (cos-theta sin-theta linear) chosen followed by cases, deaths. In fact this is user chosen as they set static and dynamic system properties to use" - ], + ] + }, + { + "cell_type": "markdown", "metadata": { - "collapsed": false, + "id": "ir1EDSiyXLWt", "pycharm": { "name": "#%% md\n" } - } - }, - { - "cell_type": "markdown", + }, "source": [ "We will have various numpy and pandas arrays where we designate label\n", "\n", @@ -636,29 +706,34 @@ "\n", "[Predtimes] = [Forecast time range] are times forecasted with \"time range\" separately defined\n", "\n" - ], - "metadata": { - "collapsed": false, - "pycharm": { - "name": "#%% md\n" - } - } + ] }, { "cell_type": "markdown", - "source": [ - "### Define Basic Control parameters" - ], "metadata": { - "collapsed": false, + "id": "Jn5RLz6YXLWt", "pycharm": { "name": "#%% md\n" } - } + }, + "source": [ + "### Define Basic Control parameters" + ] }, { "cell_type": "code", "execution_count": null, + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/", + "height": 73 + }, + "id": "n-iwtsJfXLWt", + "outputId": "9aed303d-633e-4bea-b069-95135a4e81c4", + "pycharm": { + "name": "#%%\n" + } + }, "outputs": [], "source": [ "def wraptotext(textinput,size=None):\n", @@ -738,30 +813,30 @@ "print(startbold + startred + current_time + ' ' + f'{RunName} {RunComment}' + resetfonts)\n", "\n", "Earthquake = True\n" - ], - "metadata": { - "collapsed": false, - "pycharm": { - "name": "#%%\n" - } - } + ] }, { "cell_type": "markdown", - "source": [ - "## Define input structure\n", - "\n", - "Read in data and set it up for Tensorflow with training and validation\n" - ], "metadata": { - "collapsed": false, + "id": "aDn7H3uLXLWt", "pycharm": { "name": "#%% md\n" } - } + }, + "source": [ + "## Define input structure\n", + "\n", + "Read in data and set it up for Tensorflow with training and validation\n" + ] }, { "cell_type": "markdown", + "metadata": { + "id": "KPii11m5XLWt", + "pycharm": { + "name": "#%% md\n" + } + }, "source": [ "Set train_examples, val_examples as science training and validatioon set.\n", "\n", @@ -784,16 +859,16 @@ "For validation, it is probably best to select validation location before chopping them into groups of size Nloc-sel\n", "\n", "How one groups locations for inference is not clear. One idea is to take trained network and use it to find for each location which other locations have the most attention with it. Use those locations in prediction" - ], + ] + }, + { + "cell_type": "markdown", "metadata": { - "collapsed": false, + "id": "cyjh2IzRXLWt", "pycharm": { "name": "#%% md\n" } - } - }, - { - "cell_type": "markdown", + }, "source": [ "More general input. \n", "NaN allowed value\n", @@ -809,34 +884,42 @@ "* b) Normalize\n", "* c) Add Futures\n", "* d) Add time/location encoding\n" - ], - "metadata": { - "collapsed": false, - "pycharm": { - "name": "#%% md\n" - } - } + ] }, { "cell_type": "markdown", - "source": [ - "### Setup File Systems" - ], "metadata": { - "collapsed": false, + "id": "Tw1WkueZXLWt", "pycharm": { "name": "#%% md\n" } - } + }, + "source": [ + "### Setup File Systems" + ] }, { "cell_type": "code", "execution_count": null, + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/", + "height": 1323 + }, + "id": "tSBWtrp-XLWt", + "outputId": "199f0f3d-cd8e-4e79-cae7-23963bc846a7", + "pycharm": { + "name": "#%%\n" + } + }, "outputs": [], "source": [ - "if in_colab:\n", + "if in_colab and not gregor:\n", " # find the data\n", - " COLABROOTDIR=\"/content/gdrive/My Drive/Colab Datasets\"\n", + " COLABROOTDIR=\"/content/gdrive/My Drive/ColabDatasets\"\n", + "elif in_colab and gregor:\n", + " COLABROOTDIR=\"/content/data\"\n", + " config['experiments.TFTTransformerepochs'] = config.experiments['TFTTransformerepochs']\n", "else:\n", " base_path = f'{config[\"run.workdir\"]}/{config[\"user\"]}/workspace-{config[\"meta.uuid\"]}'\n", " COLABROOTDIR = f'{base_path}/{config[\"run.datadir\"]}'\n", @@ -863,29 +946,34 @@ "\n", "print(Printer.attribute(config))\n", "TIME_stop(\"INIT\", mllog_key=\"INIT_STOP\")" - ], - "metadata": { - "collapsed": false, - "pycharm": { - "name": "#%%\n" - } - } + ] }, { "cell_type": "markdown", - "source": [ - "### Space Filling Curves" - ], "metadata": { - "collapsed": false, + "id": "r5oGKM9WXLWu", "pycharm": { "name": "#%% md\n" } - } + }, + "source": [ + "### Space Filling Curves" + ] }, { "cell_type": "code", "execution_count": null, + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/", + "height": 35 + }, + "id": "eY8AWY76XLWu", + "outputId": "5b90d24d-cd07-4a43-96d1-39abbf461ea5", + "pycharm": { + "name": "#%%\n" + } + }, "outputs": [], "source": [ "\n", @@ -1056,29 +1144,34 @@ " display(plot)\n", " StopWatch.event(\"faults_ndarray_Graph_Done\")\n", "\n" - ], - "metadata": { - "collapsed": false, - "pycharm": { - "name": "#%%\n" - } - } + ] }, { "cell_type": "markdown", - "source": [ - "# CELL READ DATA" - ], "metadata": { - "collapsed": false, + "id": "tXnFW3jmXLWu", "pycharm": { "name": "#%% md\n" } - } + }, + "source": [ + "# CELL READ DATA" + ] }, { "cell_type": "code", "execution_count": null, + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/", + "height": 8999 + }, + "id": "gChuPSoLXLWu", + "outputId": "26997510-11de-4f4f-a270-f5d29ef55e25", + "pycharm": { + "name": "#%%\n" + } + }, "outputs": [], "source": [ "\n", @@ -1761,29 +1854,34 @@ " InputPropertyNames.append(NamespredCalculated[iprop])\n", "\n", "TIME_stop(\"CELL_READ_DATA\")" - ], - "metadata": { - "collapsed": false, - "pycharm": { - "name": "#%%\n" - } - } + ] }, { "cell_type": "markdown", - "source": [ - "### Earthquake Eigensystems" - ], "metadata": { - "collapsed": false, + "id": "MYAypdgCXLWv", "pycharm": { "name": "#%% md\n" } - } + }, + "source": [ + "### Earthquake Eigensystems" + ] }, { "cell_type": "code", "execution_count": null, + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/", + "height": 35 + }, + "id": "j95JVD_-XLWv", + "outputId": "4102de13-97ee-4e9b-80a1-188930a961b9", + "pycharm": { + "name": "#%%\n" + } + }, "outputs": [], "source": [ "if UseEarthquakeEigenSystems:\n", @@ -1794,29 +1892,34 @@ "#w, v = solver.eigh(x, driver='evx')\n", "#print(w)\n", "#print(v)\n" - ], - "metadata": { - "collapsed": false, - "pycharm": { - "name": "#%%\n" - } - } + ] }, { "cell_type": "markdown", - "source": [ - "### Multiplicity Data" - ], "metadata": { - "collapsed": false, + "id": "3LqJIMN4XLWv", "pycharm": { "name": "#%% md\n" } - } + }, + "source": [ + "### Multiplicity Data" + ] }, { "cell_type": "code", "execution_count": null, + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/", + "height": 3815 + }, + "id": "LeTG7GCuXLWv", + "outputId": "c3ab37bb-4bf8-4169-9985-66469f294caf", + "pycharm": { + "name": "#%%\n" + } + }, "outputs": [], "source": [ "histogrammultiplicity_event_num = 0\n", @@ -2127,17 +2230,22 @@ "\n", " \n", "\n" - ], - "metadata": { - "collapsed": false, - "pycharm": { - "name": "#%%\n" - } - } + ] }, { "cell_type": "code", "execution_count": null, + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/", + "height": 162 + }, + "id": "aSHlZr_JXLWw", + "outputId": "0299447c-3d7c-46d3-cb8a-a69b5c3ed4fb", + "pycharm": { + "name": "#%%\n" + } + }, "outputs": [], "source": [ "def makeasmalldateplot(figure,ax, Dateaxis):\n", @@ -2516,29 +2624,34 @@ " StopWatch.event(f\"{ax.get_title()}_Graph_Done\")\n", "\n", "TIME_stop(\"MULTIPLICITY_DATA\")" - ], - "metadata": { - "collapsed": false, - "pycharm": { - "name": "#%%\n" - } - } + ] }, { "cell_type": "markdown", - "source": [ - "### End of Earthquake. Reset Timing" - ], "metadata": { - "collapsed": false, + "id": "IlJGEpkUXLWx", "pycharm": { "name": "#%% md\n" } - } + }, + "source": [ + "### End of Earthquake. Reset Timing" + ] }, { "cell_type": "code", "execution_count": null, + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/", + "height": 269 + }, + "id": "bWJtodYoXLWx", + "outputId": "0599af14-a960-40ae-9c88-2ccbec6a957b", + "pycharm": { + "name": "#%%\n" + } + }, "outputs": [], "source": [ "# Reset Start Date by a year so first entry has a 365 day sample ending at that day and so can be made an input as can all\n", @@ -2622,29 +2735,34 @@ " current_time = timenow()\n", " print(startbold + startred + 'Earthquake Setup ' + current_time + ' ' +RunName + ' ' + RunComment + resetfonts)\n", "\n" - ], - "metadata": { - "collapsed": false, - "pycharm": { - "name": "#%%\n" - } - } + ] }, { "cell_type": "markdown", - "source": [ - "### Set Earthquake Execution Mode" - ], "metadata": { - "collapsed": false, + "id": "nek83JmsXLWx", "pycharm": { "name": "#%% md\n" } - } + }, + "source": [ + "### Set Earthquake Execution Mode" + ] }, { "cell_type": "code", "execution_count": null, + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/", + "height": 35 + }, + "id": "cI_fvdQLXLWx", + "outputId": "bfc6d6e1-43ec-4231-ed5f-4d184d8cbc5b", + "pycharm": { + "name": "#%%\n" + } + }, "outputs": [], "source": [ "if Earthquake:\n", @@ -2654,29 +2772,34 @@ " if Dailyunit == 14:\n", " GenerateFutures = True\n", " UseFutures = True" - ], - "metadata": { - "collapsed": false, - "pycharm": { - "name": "#%%\n" - } - } + ] }, { "cell_type": "markdown", - "source": [ - "### Plot Earthquake Images" - ], "metadata": { - "collapsed": false, + "id": "eKoLsfhIXLWx", "pycharm": { "name": "#%% md\n" } - } + }, + "source": [ + "### Plot Earthquake Images" + ] }, { "cell_type": "code", "execution_count": null, + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/", + "height": 20000 + }, + "id": "c-NH-1-LXLWx", + "outputId": "b2523c74-ec3c-4cde-c23a-b31a4eb58b4c", + "pycharm": { + "name": "#%%\n" + } + }, "outputs": [], "source": [ "# Tom: added local min and max to graphs not based on absolute values.\n", @@ -2761,84 +2884,94 @@ "\n", "StopWatch.event(\"PLOTTED_EARTHQUAKE_IMAGES\")\n", "TIME_stop(\"PLOTS\")" - ], - "metadata": { - "collapsed": false, - "pycharm": { - "name": "#%%\n" - } - } + ] }, { "cell_type": "markdown", + "metadata": { + "id": "z_l8GkhNXLWx", + "pycharm": { + "name": "#%% md\n" + } + }, "source": [ "### Read and setup NIH Covariates August 2020 and January, April 2021 Data\n", "\n", "new collection of time dependent covariates (even if constant).\n", "\n", "cases and deaths and location property from previous data\n" - ], - "metadata": { - "collapsed": false, - "pycharm": { - "name": "#%% md\n" - } - } + ] }, { "cell_type": "markdown", - "source": [ - "## Process Input Data in various ways\n", - "\n" - ], "metadata": { - "collapsed": false, + "id": "Q1ZrBDUcXLWx", "pycharm": { "name": "#%% md\n" } - } + }, + "source": [ + "## Process Input Data in various ways\n", + "\n" + ] }, { "cell_type": "markdown", - "source": [ - "### Set TFT Mode" - ], "metadata": { - "collapsed": false, + "id": "DYbHYEEeXLWx", "pycharm": { "name": "#%% md\n" } - } + }, + "source": [ + "### Set TFT Mode" + ] }, { "cell_type": "code", "execution_count": null, - "outputs": [], - "source": [ - "UseTFTModel = True\n" - ], "metadata": { - "collapsed": false, + "colab": { + "base_uri": "https://localhost:8080/", + "height": 35 + }, + "id": "wiPbnTuZXLWx", + "outputId": "39973a8b-f85e-426c-ccfd-93043cfeb45d", "pycharm": { "name": "#%%\n" } - } + }, + "outputs": [], + "source": [ + "UseTFTModel = True\n" + ] }, { "cell_type": "markdown", - "source": [ - "### Convert Cumulative to Daily" - ], "metadata": { - "collapsed": false, + "id": "v8YD_ZYvXLWy", "pycharm": { "name": "#%% md\n" } - } + }, + "source": [ + "### Convert Cumulative to Daily" + ] }, { "cell_type": "code", "execution_count": null, + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/", + "height": 35 + }, + "id": "oIFpyZRMXLWy", + "outputId": "42b9c1bb-6ea2-49fb-95cc-16cc552b73f5", + "pycharm": { + "name": "#%%\n" + } + }, "outputs": [], "source": [ "# Gregor: DELETE\n", @@ -2857,31 +2990,36 @@ " print('Original summed counts ' + str(originalnumber) + ' become ' + str(newnumber)+ ' Cases, Deaths')\n", "\n", " BasicInputTimeSeries = NewBasicInputTimeSeries\n" - ], - "metadata": { - "collapsed": false, - "pycharm": { - "name": "#%%\n" - } - } + ] }, { "cell_type": "markdown", - "source": [ - "### Normalize All Static and Dynamic Properties\n", - "\n", - "for Static Properties BasicInputStaticProps[Nloc,NpropperTimeStatic] converts to NormedInputStaticProps[Nloc,NpropperTimeStatic]" - ], "metadata": { - "collapsed": false, + "id": "0OFGx3Q9XLWy", "pycharm": { "name": "#%% md\n" } - } + }, + "source": [ + "### Normalize All Static and Dynamic Properties\n", + "\n", + "for Static Properties BasicInputStaticProps[Nloc,NpropperTimeStatic] converts to NormedInputStaticProps[Nloc,NpropperTimeStatic]" + ] }, { "cell_type": "code", "execution_count": null, + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/", + "height": 839 + }, + "id": "EMbEDemWXLWy", + "outputId": "b61d2976-2c52-4a22-c3f8-48e6bf483cd9", + "pycharm": { + "name": "#%%\n" + } + }, "outputs": [], "source": [ "# Gregor: DELETE some portions of this to be reviewed\n", @@ -2986,31 +3124,36 @@ " for propval in range (0,7):\n", " line += ' ' + str(round(QuantityStatistics[iprop,propval],3))\n", " print(line)\n" - ], - "metadata": { - "collapsed": false, - "pycharm": { - "name": "#%%\n" - } - } + ] }, { "cell_type": "markdown", - "source": [ - "### Set up Futures\n", - "\n", - "-- currently at unit time level " - ], "metadata": { - "collapsed": false, + "id": "mZ60LvvPXLWy", "pycharm": { "name": "#%% md\n" } - } + }, + "source": [ + "### Set up Futures\n", + "\n", + "-- currently at unit time level " + ] }, { "cell_type": "code", "execution_count": null, + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/", + "height": 35 + }, + "id": "uX39TZweXLWy", + "outputId": "67bc3fb0-6642-4ad1-ccdf-e11301de1e4c", + "pycharm": { + "name": "#%%\n" + } + }, "outputs": [], "source": [ "class Future:\n", @@ -3049,33 +3192,38 @@ " if Earthquake:\n", " Futures[i].daystart = 0\n", "\n" - ], - "metadata": { - "collapsed": false, - "pycharm": { - "name": "#%%\n" - } - } + ] }, { "cell_type": "markdown", + "metadata": { + "id": "Nljxp0TnXLWy", + "pycharm": { + "name": "#%% md\n" + } + }, "source": [ "### Set up mappings of locations\n", "\n", "In next cell, we map locations for BEFORE location etc added\n", "\n", "In cell after that we do same for sequences" - ], - "metadata": { - "collapsed": false, - "pycharm": { - "name": "#%% md\n" - } - } + ] }, { "cell_type": "code", "execution_count": null, + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/", + "height": 696 + }, + "id": "nAb69M2XXLWy", + "outputId": "129c4e22-e109-4f35-f48c-8c2ddd9ac548", + "pycharm": { + "name": "#%%\n" + } + }, "outputs": [], "source": [ "OriginalNloc = Nloc\n", @@ -3108,16 +3256,16 @@ " MappedLocations = np.arange(0,Nloc, dtype=int)\n", " LookupLocations = np.arange(0,Nloc, dtype=int)\n", " MappedNloc = Nloc\n" - ], - "metadata": { - "collapsed": false, - "pycharm": { - "name": "#%%\n" - } - } + ] }, { "cell_type": "markdown", + "metadata": { + "id": "gIYoIsT-XLWy", + "pycharm": { + "name": "#%% md\n" + } + }, "source": [ "###Property and Prediction Data Structures\n", "\n", @@ -3158,29 +3306,34 @@ " * Predictions per Time are NpredperTime = NumpredbasicperTime + NumpredFuturedperTime*LengthFutures\n", " * Predictions per sequence Npredperseq = NpredperTime\n", "\n" - ], - "metadata": { - "collapsed": false, - "pycharm": { - "name": "#%% md\n" - } - } + ] }, { "cell_type": "markdown", - "source": [ - "### Set Requested Properties Predictions Encodings" - ], "metadata": { - "collapsed": false, + "id": "h9EKDRX-XLWy", "pycharm": { "name": "#%% md\n" } - } + }, + "source": [ + "### Set Requested Properties Predictions Encodings" + ] }, { "cell_type": "code", "execution_count": null, + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/", + "height": 35 + }, + "id": "b-f1fNdSXLWy", + "outputId": "364232ec-7e21-4c48-dfd5-42ee2768041b", + "pycharm": { + "name": "#%%\n" + } + }, "outputs": [], "source": [ "# FuturePred = -1 Means NO FUTURE >= 0 FUTURED\n", @@ -3221,29 +3374,34 @@ " PredSource = ['Dynamic','Dynamic','Dynamic','Dynamic']\n", " PredSourceNumber = [0,6,7,8]\n", " FuturedPred = [1,1,1,1]\n" - ], - "metadata": { - "collapsed": false, - "pycharm": { - "name": "#%%\n" - } - } + ] }, { "cell_type": "markdown", - "source": [ - "### Choose Input and Predicted Quantities" - ], "metadata": { - "collapsed": false, + "id": "dDzWxDUwXLWz", "pycharm": { "name": "#%% md\n" } - } + }, + "source": [ + "### Choose Input and Predicted Quantities" + ] }, { "cell_type": "code", "execution_count": null, + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/", + "height": 53 + }, + "id": "MB00UcdrXLWz", + "outputId": "f3ad05a7-9b19-4ae4-ff8e-d9602688fce9", + "pycharm": { + "name": "#%%\n" + } + }, "outputs": [], "source": [ "# Gregor: DELETE some portions of this, review and identify\n", @@ -3361,31 +3519,36 @@ " NewNormedInputStaticProps = NormedInputStaticProps\n", " NewNormedDynamicPropertyTimeSeries = NormedDynamicPropertyTimeSeries\n", "\n" - ], - "metadata": { - "collapsed": false, - "pycharm": { - "name": "#%%\n" - } - } + ] }, { "cell_type": "markdown", - "source": [ - "### Calculate Futures\n", - "\n", - "Start Predictions" - ], "metadata": { - "collapsed": false, + "id": "M9hGzpYpXLWz", "pycharm": { "name": "#%% md\n" } - } + }, + "source": [ + "### Calculate Futures\n", + "\n", + "Start Predictions" + ] }, { "cell_type": "code", "execution_count": null, + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/", + "height": 7538 + }, + "id": "YD0ewXGDXLWz", + "outputId": "4576a0b9-45aa-4349-90b3-4889c241be1f", + "pycharm": { + "name": "#%%\n" + } + }, "outputs": [], "source": [ "# Order of Predictions *****************************\n", @@ -3469,16 +3632,16 @@ " print(line)\n", "\n", " # Note that only Predictionwgt and Predictionname defined for later addons" - ], - "metadata": { - "collapsed": false, - "pycharm": { - "name": "#%%\n" - } - } + ] }, { "cell_type": "markdown", + "metadata": { + "id": "Yn5vp3DRXLWz", + "pycharm": { + "name": "#%% md\n" + } + }, "source": [ "### Set up Predictions \n", "\n", @@ -3489,17 +3652,22 @@ "Note this is \"pure forecast\" which are of quantities used in driving data allowing us to iitialize prediction to input\n", "\n", "NaN represents non existent data" - ], - "metadata": { - "collapsed": false, - "pycharm": { - "name": "#%% md\n" - } - } + ] }, { "cell_type": "code", "execution_count": null, + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/", + "height": 73 + }, + "id": "fDvCXdQKXLWz", + "outputId": "ee8e9e6b-d2f0-4d9b-c042-c03a5a80e97b", + "pycharm": { + "name": "#%%\n" + } + }, "outputs": [], "source": [ "if PredictionsfromInputs:\n", @@ -3547,29 +3715,34 @@ "\n", "\n", " " - ], - "metadata": { - "collapsed": false, - "pycharm": { - "name": "#%%\n" - } - } + ] }, { "cell_type": "markdown", - "source": [ - "### Clean-up Input quantities#################" - ], "metadata": { - "collapsed": false, + "id": "a_k4VDT2XLWz", "pycharm": { "name": "#%% md\n" } - } + }, + "source": [ + "### Clean-up Input quantities#################" + ] }, { "cell_type": "code", "execution_count": null, + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/", + "height": 106 + }, + "id": "7PCgvzPgXLWz", + "outputId": "b1d3d081-da6f-48bf-ee97-44ba3861a63a", + "pycharm": { + "name": "#%%\n" + } + }, "outputs": [], "source": [ "def checkNaN(y):\n", @@ -3625,29 +3798,34 @@ "print('Dynamic Properties')\n", "\n", "checkNaN(NormedDynamicPropertyTimeSeries)" - ], - "metadata": { - "collapsed": false, - "pycharm": { - "name": "#%%\n" - } - } + ] }, { "cell_type": "markdown", - "source": [ - "###Setup Sequences and UseTFTModel" - ], "metadata": { - "collapsed": false, + "id": "8F5vIoygXLW0", "pycharm": { "name": "#%% md\n" } - } + }, + "source": [ + "###Setup Sequences and UseTFTModel" + ] }, { "cell_type": "code", "execution_count": null, + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/", + "height": 35 + }, + "id": "GaQ6BSyXXLW0", + "outputId": "a44f9325-66c0-4308-bd20-b2c6993bc50a", + "pycharm": { + "name": "#%%\n" + } + }, "outputs": [], "source": [ "Num_SeqExtraUsed = Tseq-1\n", @@ -3677,35 +3855,40 @@ "if SymbolicWindows:\n", " RawInputSeqDimension = 1\n", " Num_SeqExtra = Num_SeqExtraUsed\n" - ], - "metadata": { - "collapsed": false, - "pycharm": { - "name": "#%%\n" - } - } + ] }, { "cell_type": "markdown", - "source": [ - "###Generate Sequences from Time labelled data \n", - "given Tseq set above" - ], "metadata": { - "collapsed": false, + "id": "8IJUOYPRXLW0", "pycharm": { "name": "#%% md\n" } - } + }, + "source": [ + "###Generate Sequences from Time labelled data \n", + "given Tseq set above" + ] }, { "cell_type": "code", "execution_count": null, - "outputs": [], - "source": [ - "if GenerateSequences:\n", - " UseProperties = np.full(NpropperTime, True, dtype=bool)\n", - "\n", + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/", + "height": 53 + }, + "id": "1I9aJbmsXLW0", + "outputId": "b9a11b4d-445c-4d00-d69a-933bde49b082", + "pycharm": { + "name": "#%%\n" + } + }, + "outputs": [], + "source": [ + "if GenerateSequences:\n", + " UseProperties = np.full(NpropperTime, True, dtype=bool)\n", + "\n", " Npropperseq = 0\n", " IndexintoPropertyArrays = np.empty(NpropperTime, dtype = int)\n", " for iprop in range(0,NpropperTime):\n", @@ -3737,29 +3920,34 @@ " gc.collect()\n", "\n", "GlobalTimeMask = np.empty([1,1,1,Tseq,Tseq],dtype =np.float32)" - ], - "metadata": { - "collapsed": false, - "pycharm": { - "name": "#%%\n" - } - } + ] }, { "cell_type": "markdown", - "source": [ - "### Define Possible Temporal and Spatial Positional Encodings" - ], "metadata": { - "collapsed": false, + "id": "LMa5krKSXLW0", "pycharm": { "name": "#%% md\n" } - } + }, + "source": [ + "### Define Possible Temporal and Spatial Positional Encodings" + ] }, { "cell_type": "code", "execution_count": null, + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/", + "height": 53 + }, + "id": "w0IScQy4XLW0", + "outputId": "5892d4c1-6192-4d21-b615-814ee0effdec", + "pycharm": { + "name": "#%%\n" + } + }, "outputs": [], "source": [ "# PARAMETER. Possible functions as input MLCOMMONS RELEVANT\n", @@ -3973,29 +4161,34 @@ " predposition += 1\n", " Numberpredaddons += 1\n", " Predictionwgt.append(0.25)" - ], - "metadata": { - "collapsed": false, - "pycharm": { - "name": "#%%\n" - } - } + ] }, { "cell_type": "markdown", - "source": [ - "### Add in Temporal and Spatial Encoding" - ], "metadata": { - "collapsed": false, + "id": "nGsJpInGXLW0", "pycharm": { "name": "#%% md\n" } - } + }, + "source": [ + "### Add in Temporal and Spatial Encoding" + ] }, { "cell_type": "code", "execution_count": null, + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/", + "height": 2823 + }, + "id": "GUql58aPXLW0", + "outputId": "8a235473-7178-4ca0-8b7d-683ba813d258", + "pycharm": { + "name": "#%%\n" + } + }, "outputs": [], "source": [ "def SetNewAverages(InputList): # name min max mean std\n", @@ -4141,29 +4334,34 @@ " RawInputSequencesTOT = None\n", "if GarbageCollect:\n", " gc.collect()\n" - ], - "metadata": { - "collapsed": false, - "pycharm": { - "name": "#%%\n" - } - } + ] }, { "cell_type": "markdown", - "source": [ - "###Set up NNSE and Plots including Futures" - ], "metadata": { - "collapsed": false, + "id": "znUeiOEgXLW0", "pycharm": { "name": "#%% md\n" } - } + }, + "source": [ + "###Set up NNSE and Plots including Futures" + ] }, { "cell_type": "code", "execution_count": null, + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/", + "height": 35 + }, + "id": "2m0RghgKXLW1", + "outputId": "b57cb592-dbe5-458b-ee99-273f8057c983", + "pycharm": { + "name": "#%%\n" + } + }, "outputs": [], "source": [ "#Set up NNSE Normalized Nash Sutcliffe Efficiency\n", @@ -4173,29 +4371,34 @@ "for ipred in range(0,NpredperseqTOT):\n", " CalculateNNSE[ipred] = True\n", " PlotPredictions[ipred] = True" - ], - "metadata": { - "collapsed": false, - "pycharm": { - "name": "#%%\n" - } - } + ] }, { "cell_type": "markdown", - "source": [ - "## Location Based Validation" - ], "metadata": { - "collapsed": false, + "id": "uPnlQVssXLW1", "pycharm": { "name": "#%% md\n" } - } + }, + "source": [ + "## Location Based Validation" + ] }, { "cell_type": "code", "execution_count": null, + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/", + "height": 785 + }, + "id": "xc1IRGE1XLW1", + "outputId": "9d806ae8-a3f4-4fb0-d2d2-9467f1b6dff3", + "pycharm": { + "name": "#%%\n" + } + }, "outputs": [], "source": [ "LocationBasedValidation = False\n", @@ -4347,29 +4550,34 @@ " line += \" \" + str(PrimaryTrainingvetoquake[iquake]) + \" \" + str(SecondaryTrainingvetoquake[iquake])\n", " line += \" Val \" + str(PrimaryValidationvetoquake[iquake]) + \" \" + str(SecondaryValidationvetoquake[iquake])\n", " print(line)" - ], - "metadata": { - "collapsed": false, - "pycharm": { - "name": "#%%\n" - } - } + ] }, { "cell_type": "markdown", - "source": [ - "## LSTM Control Parameters EDIT" - ], "metadata": { - "collapsed": false, + "id": "AdlY5guUXLW1", "pycharm": { "name": "#%% md\n" } - } + }, + "source": [ + "## LSTM Control Parameters EDIT" + ] }, { "cell_type": "code", "execution_count": null, + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/", + "height": 35 + }, + "id": "uD_UmK3hXLW1", + "outputId": "0dfc6c69-9dba-47f9-fe36-0d1498071d65", + "pycharm": { + "name": "#%%\n" + } + }, "outputs": [], "source": [ "CustomLoss = 1 \n", @@ -4406,29 +4614,34 @@ "if LocationBasedValidation:\n", " AnyOldValidation = LocationBasedValidation\n", "LSTMvalidationfrac = AnyOldValidation" - ], - "metadata": { - "collapsed": false, - "pycharm": { - "name": "#%%\n" - } - } + ] }, { "cell_type": "markdown", - "source": [ - "## Important Parameters defining Transformer project EDIT" - ], "metadata": { - "collapsed": false, + "id": "w-6ybuw8XLW1", "pycharm": { "name": "#%% md\n" } - } + }, + "source": [ + "## Important Parameters defining Transformer project EDIT" + ] }, { "cell_type": "code", "execution_count": null, + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/", + "height": 35 + }, + "id": "Lal5wEWSXLW1", + "outputId": "a9c410a2-228d-4970-dfdc-6f6444af2363", + "pycharm": { + "name": "#%%\n" + } + }, "outputs": [], "source": [ "ActivateAttention = False\n", @@ -4459,29 +4672,34 @@ "LinearInputTemporalEncoding = -1 # natural for COVID\n", "TransformerInputTemporalEncoding = 10000\n", "UseTransformerInputTemporalEncoding = False" - ], - "metadata": { - "collapsed": false, - "pycharm": { - "name": "#%%\n" - } - } + ] }, { "cell_type": "markdown", - "source": [ - "## General Control Parameters" - ], "metadata": { - "collapsed": false, + "id": "lQoh62DtXLW1", "pycharm": { "name": "#%% md\n" } - } + }, + "source": [ + "## General Control Parameters" + ] }, { "cell_type": "code", "execution_count": null, + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/", + "height": 53 + }, + "id": "9NiOAr4iXLW1", + "outputId": "e1932c40-c345-496d-d99d-14058ec7a1cf", + "pycharm": { + "name": "#%%\n" + } + }, "outputs": [], "source": [ "OuterBatchDimension = Num_Seq * TrainingNloc\n", @@ -4501,17 +4719,22 @@ "print('Start ' + str(StartDate) + ' Cutoff ' + str(CutoffDate) + \" sequence index \" + str(NumericalCutoff))\n", "\n", "TimeCutLabel = [' All Time ',' Start ',' End ']" - ], - "metadata": { - "collapsed": false, - "pycharm": { - "name": "#%%\n" - } - } + ] }, { "cell_type": "code", "execution_count": null, + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/", + "height": 287 + }, + "id": "jdpHfzV-XLW1", + "outputId": "ee9f8a40-642d-42a0-ee2a-750f9f0ac0b9", + "pycharm": { + "name": "#%%\n" + } + }, "outputs": [], "source": [ "print(\"Size of sequence window Tseq \", str(Tseq))\n", @@ -4522,43 +4745,48 @@ "print(\"Number of internal properties per sequence adding in explicit space-time encoding \", str(NpropperseqTOT))\n", "print(\"Total number of predictions per sequence NpredperseqTOT \", str(NpredperseqTOT))\n", "TIME_stop(\"EVAL\")" - ], - "metadata": { - "collapsed": false, - "pycharm": { - "name": "#%%\n" - } - } + ] }, { "cell_type": "markdown", - "source": [ - "## Useful Time series utilities" - ], "metadata": { - "collapsed": false, + "id": "f6LwWKUnXLW1", "pycharm": { "name": "#%% md\n" } - } + }, + "source": [ + "## Useful Time series utilities" + ] }, { "cell_type": "markdown", - "source": [ - "### DLprediction\n", - "\n", - "Prediction and Visualization LSTM+Transformer" - ], "metadata": { - "collapsed": false, + "id": "VegxR5gRXLW1", "pycharm": { "name": "#%% md\n" } - } + }, + "source": [ + "### DLprediction\n", + "\n", + "Prediction and Visualization LSTM+Transformer" + ] }, { "cell_type": "code", "execution_count": null, + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/", + "height": 35 + }, + "id": "iKovYzd6XLW1", + "outputId": "e4d116bc-67f4-43e4-ba19-b582f361547e", + "pycharm": { + "name": "#%%\n" + } + }, "outputs": [], "source": [ "MSE_event_num=0\n", @@ -4823,29 +5051,34 @@ " DLprediction2F(Xin, yin, DLmodel, modelflag, NNSE_results_list)\n", "\n", " return FitPredictions " - ], - "metadata": { - "collapsed": false, - "pycharm": { - "name": "#%%\n" - } - } + ] }, { "cell_type": "markdown", - "source": [ - "### Spatial Earthquake Plots" - ], "metadata": { - "collapsed": false, + "id": "RoEy_dKWXLW2", "pycharm": { "name": "#%% md\n" } - } + }, + "source": [ + "### Spatial Earthquake Plots" + ] }, { "cell_type": "code", "execution_count": null, + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/", + "height": 35 + }, + "id": "sCZYZvZJXLW2", + "outputId": "4b38c97f-de54-4e68-8f0c-7f72c7e06531", + "pycharm": { + "name": "#%%\n" + } + }, "outputs": [], "source": [ "def ProduceSpatialQuakePlot(Observations, FitPredictions):\n", @@ -4907,29 +5140,34 @@ " InputTitles.append(Actualday.strftime(\"%d/%m/%Y\") + ' Predicted ' + Predictionbasicname[PredictedQuantity])\n", " plotimages(InputImages,InputTitles,NumpredbasicperTime,2)\n", " " - ], - "metadata": { - "collapsed": false, - "pycharm": { - "name": "#%%\n" - } - } + ] }, { "cell_type": "markdown", - "source": [ - "###Organize Location v Time Plots" - ], "metadata": { - "collapsed": false, + "id": "UXcxfOZ3XLW2", "pycharm": { "name": "#%% md\n" } - } + }, + "source": [ + "###Organize Location v Time Plots" + ] }, { "cell_type": "code", "execution_count": null, + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/", + "height": 35 + }, + "id": "BC9iMhJvXLW2", + "outputId": "39225ca4-30da-4c37-a12c-8ad8a4a87e13", + "pycharm": { + "name": "#%%\n" + } + }, "outputs": [], "source": [ "def ProduceIndividualPlots(Observations, FitPredictions):\n", @@ -5049,39 +5287,44 @@ " print(printstring)\n", " \n", " return fips_b,fips_w" - ], - "metadata": { - "collapsed": false, - "pycharm": { - "name": "#%%\n" - } - } + ] }, { "cell_type": "markdown", - "source": [], "metadata": { - "collapsed": false, + "id": "Tf9HQepkXLW3", "pycharm": { "name": "#%% md\n" } - } + }, + "source": [] }, { "cell_type": "markdown", - "source": [ - "### Summed & By Location Plots" - ], "metadata": { - "collapsed": false, + "id": "P1ZMcyQnXLW3", "pycharm": { "name": "#%% md\n" } - } + }, + "source": [ + "### Summed & By Location Plots" + ] }, { "cell_type": "code", "execution_count": null, + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/", + "height": 35 + }, + "id": "4rvsf-u9XLW3", + "outputId": "693a03bb-633e-45af-bb06-6648bf8f4b54", + "pycharm": { + "name": "#%%\n" + } + }, "outputs": [], "source": [ "def setValTrainlabel(iValTrain):\n", @@ -5573,31 +5816,36 @@ " global predvsreal_event_num\n", " StopWatch.event(f\"predvsreal_{rowloop} event_num:{predvsreal_event_num}\")\n", " predvsreal_event_num+=1\n" - ], - "metadata": { - "collapsed": false, - "pycharm": { - "name": "#%%\n" - } - } + ] }, { "cell_type": "markdown", - "source": [ - "### Calculate\n", - "\n", - "\n" - ], "metadata": { - "collapsed": false, + "id": "P9knd7xdXLW4", "pycharm": { "name": "#%% md\n" } - } + }, + "source": [ + "### Calculate\n", + "\n", + "\n" + ] }, { "cell_type": "code", "execution_count": null, + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/", + "height": 35 + }, + "id": "1pSATi_bXLW4", + "outputId": "78fadc36-86d5-4713-985b-a0c1b4882f0e", + "pycharm": { + "name": "#%%\n" + } + }, "outputs": [], "source": [ "# Calculate NNSE\n", @@ -5734,17 +5982,22 @@ " ' S:' + str(round(SummedNNSE,3)) +\n", " ' SV:' + str(round(SummedNNSEV,3)))\n", " return NNSE_results_list" - ], - "metadata": { - "collapsed": false, - "pycharm": { - "name": "#%%\n" - } - } + ] }, { "cell_type": "code", "execution_count": null, + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/", + "height": 35 + }, + "id": "U5Gjhy3eXLW4", + "outputId": "f607ffba-b58e-4882-bc98-a1a853bec9c7", + "pycharm": { + "name": "#%%\n" + } + }, "outputs": [], "source": [ "def weightedcustom_lossGCF1(y_actual, y_pred, sample_weight):\n", @@ -5794,29 +6047,34 @@ " if len(tupl) >= 4:\n", " tensordiff /= tupl[2]\n", " return tensordiff\n" - ], - "metadata": { - "collapsed": false, - "pycharm": { - "name": "#%%\n" - } - } + ] }, { "cell_type": "markdown", - "source": [ - "### Custom Loss Functions" - ], "metadata": { - "collapsed": false, + "id": "d9Jw1rIEXLW4", "pycharm": { "name": "#%% md\n" } - } + }, + "source": [ + "### Custom Loss Functions" + ] }, { "cell_type": "code", "execution_count": null, + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/", + "height": 35 + }, + "id": "M4UAu0wtXLW4", + "outputId": "b35fbaa2-7c0a-4b50-bb31-c5fc77c019ec", + "pycharm": { + "name": "#%%\n" + } + }, "outputs": [], "source": [ "def custom_lossGCF1(y_actual,y_pred):\n", @@ -5881,29 +6139,34 @@ " tensordiff = y_actual-y_pred\n", " newtensordiff = tf.where(tf.math.is_nan(tensordiff), tf.zeros_like(tensordiff), tensordiff)\n", " return tf.math.reduce_mean(tf.math.square(newtensordiff))" - ], - "metadata": { - "collapsed": false, - "pycharm": { - "name": "#%%\n" - } - } + ] }, { "cell_type": "markdown", - "source": [ - "### Utility: Shuffle, Finalize\n" - ], "metadata": { - "collapsed": false, + "id": "XLV8SFnmXLW5", "pycharm": { "name": "#%% md\n" } - } + }, + "source": [ + "### Utility: Shuffle, Finalize\n" + ] }, { "cell_type": "code", "execution_count": null, + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/", + "height": 35 + }, + "id": "mCWNS80BXLW5", + "outputId": "815e9096-2657-453d-b1dd-3ba4439a9a6f", + "pycharm": { + "name": "#%%\n" + } + }, "outputs": [], "source": [ "def SetSpacetime(BasicTimes):\n", @@ -6127,29 +6390,34 @@ "\n", "\n", "\n" - ], - "metadata": { - "collapsed": false, - "pycharm": { - "name": "#%%\n" - } - } + ] }, { "cell_type": "markdown", - "source": [ - "### DLPrediction2E printloss ?DEL" - ], "metadata": { - "collapsed": false, + "id": "vMEZrS6tXLW5", "pycharm": { "name": "#%% md\n" } - } + }, + "source": [ + "### DLPrediction2E printloss ?DEL" + ] }, { "cell_type": "code", "execution_count": null, + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/", + "height": 35 + }, + "id": "T9ZgNqrXXLW5", + "outputId": "b7947fa6-4e80-4c5f-c518-b23da036826c", + "pycharm": { + "name": "#%%\n" + } + }, "outputs": [], "source": [ "\n", @@ -6487,29 +6755,34 @@ " \n", " print(startbold+startred+ 'END DLPrediction2E ' +current_time + ' ' + RunName + RunComment +resetfonts) \n", " return \n" - ], - "metadata": { - "collapsed": false, - "pycharm": { - "name": "#%%\n" - } - } + ] }, { "cell_type": "markdown", - "source": [ - "### DLPrediction2F Sensitivity" - ], "metadata": { - "collapsed": false, + "id": "FEz-Y2eqXLW5", "pycharm": { "name": "#%% md\n" } - } + }, + "source": [ + "### DLPrediction2F Sensitivity" + ] }, { "cell_type": "code", "execution_count": null, + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/", + "height": 35 + }, + "id": "_XyneZF-XLW5", + "outputId": "afecf9af-0566-416e-82df-139b7c4c82fe", + "pycharm": { + "name": "#%%\n" + } + }, "outputs": [], "source": [ "def DLprediction2F(Xin, yin, DLmodel, modelflag, NNSE_results_list):\n", @@ -6798,53 +7071,58 @@ " current_time = timenow() \n", " print(startbold+startred+ '\\nEND DLPrediction2F ' + current_time + ' ' + RunName + RunComment +resetfonts) \n", " return \n" - ], - "metadata": { - "collapsed": false, - "pycharm": { - "name": "#%%\n" - } - } + ] }, { "cell_type": "markdown", - "source": [ - "# TFT Model" - ], "metadata": { - "collapsed": false, + "id": "UeyrsdaVXLW6", "pycharm": { "name": "#%% md\n" } - } + }, + "source": [ + "# TFT Model" + ] }, { "cell_type": "markdown", - "source": [ - "##Set up TFT" - ], "metadata": { - "collapsed": false, + "id": "Ei7exytNXLW6", "pycharm": { "name": "#%% md\n" } - } + }, + "source": [ + "##Set up TFT" + ] }, { "cell_type": "markdown", - "source": [ - "###Data and Input Types" - ], "metadata": { - "collapsed": false, + "id": "62f0bqBPXLW6", "pycharm": { "name": "#%% md\n" } - } + }, + "source": [ + "###Data and Input Types" + ] }, { "cell_type": "code", "execution_count": null, + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/", + "height": 35 + }, + "id": "4qnapuHZXLW6", + "outputId": "b9fc59c1-594c-421b-9fff-f4b26bed17c9", + "pycharm": { + "name": "#%%\n" + } + }, "outputs": [], "source": [ "# Type defintions\n", @@ -6894,29 +7172,34 @@ " if count[j] == 0:\n", " continue\n", " print(names[j] + ' has NaN ' + str(count[j]))" - ], - "metadata": { - "collapsed": false, - "pycharm": { - "name": "#%%\n" - } - } + ] }, { "cell_type": "markdown", - "source": [ - "###Convert FFFFWNPF to TFT" - ], "metadata": { - "collapsed": false, + "id": "d_S25KoJXLW6", "pycharm": { "name": "#%% md\n" } - } + }, + "source": [ + "###Convert FFFFWNPF to TFT" + ] }, { "cell_type": "code", "execution_count": null, + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/", + "height": 7659 + }, + "id": "Pa8kXC8kXLW6", + "outputId": "7a41cf8a-b438-4f62-ecf6-94f740a1d47b", + "pycharm": { + "name": "#%%\n" + } + }, "outputs": [], "source": [ "\n", @@ -7116,29 +7399,34 @@ " CalculateNNSE[PredictedQuantity+j] = PlotFutures[ifuture]\n", "\n", "\n" - ], - "metadata": { - "collapsed": false, - "pycharm": { - "name": "#%%\n" - } - } + ] }, { "cell_type": "markdown", - "source": [ - "###TFT Setup" - ], "metadata": { - "collapsed": false, + "id": "fvJdAutKXLW6", "pycharm": { "name": "#%% md\n" } - } + }, + "source": [ + "###TFT Setup" + ] }, { "cell_type": "code", "execution_count": null, + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/", + "height": 73 + }, + "id": "fjA8nTKhXLW6", + "outputId": "4a1fa22c-dd13-4a60-e88f-ea525bdf587c", + "pycharm": { + "name": "#%%\n" + } + }, "outputs": [], "source": [ "if gregor:\n", @@ -7274,29 +7562,34 @@ "TFTMultivariate = True\n", "\n", "TFTuse_testing_mode = False" - ], - "metadata": { - "collapsed": false, - "pycharm": { - "name": "#%%\n" - } - } + ] }, { "cell_type": "markdown", - "source": [ - "###Base Formatter" - ], "metadata": { - "collapsed": false, + "id": "tr73MPMQXLW7", "pycharm": { "name": "#%% md\n" } - } + }, + "source": [ + "###Base Formatter" + ] }, { "cell_type": "code", "execution_count": null, + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/", + "height": 35 + }, + "id": "0m4JkMw6XLW7", + "outputId": "592b41dd-432c-415e-e53c-5fb4e1d052c5", + "pycharm": { + "name": "#%%\n" + } + }, "outputs": [], "source": [ "\n", @@ -7482,29 +7775,34 @@ " fixed_params.update(self._get_tft_input_indices())\n", "\n", " return fixed_params" - ], - "metadata": { - "collapsed": false, - "pycharm": { - "name": "#%%\n" - } - } + ] }, { "cell_type": "markdown", - "source": [ - "###TFT FFFFWNPF Formatter" - ], "metadata": { - "collapsed": false, + "id": "hrKizd72XLW7", "pycharm": { "name": "#%% md\n" } - } + }, + "source": [ + "###TFT FFFFWNPF Formatter" + ] }, { "cell_type": "code", "execution_count": null, + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/", + "height": 35 + }, + "id": "E3chh_rUXLW7", + "outputId": "4cb507f2-029c-4a64-d2fc-879299c03feb", + "pycharm": { + "name": "#%%\n" + } + }, "outputs": [], "source": [ "# Custom formatting functions for FFFFWNPF datasets.\n", @@ -7703,29 +8001,34 @@ " numtrain = TFTdfTotalshape[0]\n", " numvalid = TFTdfTotalshape[0]\n", " return numtrain, numvalid" - ], - "metadata": { - "collapsed": false, - "pycharm": { - "name": "#%%\n" - } - } + ] }, { "cell_type": "markdown", - "source": [ - "###Set TFT Parameter Dictionary" - ], "metadata": { - "collapsed": false, + "id": "7B6OudqXXLW7", "pycharm": { "name": "#%% md\n" } - } + }, + "source": [ + "###Set TFT Parameter Dictionary" + ] }, { "cell_type": "code", "execution_count": null, + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/", + "height": 35 + }, + "id": "QCRrxzafXLW7", + "outputId": "0a15360c-13ca-46dd-8fa7-25d53bdf43fe", + "pycharm": { + "name": "#%%\n" + } + }, "outputs": [], "source": [ "def setTFTparameters(data_formatter):\n", @@ -7780,29 +8083,34 @@ "\n", " return params\n", " " - ], - "metadata": { - "collapsed": false, - "pycharm": { - "name": "#%%\n" - } - } + ] }, { "cell_type": "markdown", - "source": [ - "###TFTTools" - ], "metadata": { - "collapsed": false, + "id": "Eyo2NuaGXLW7", "pycharm": { "name": "#%% md\n" } - } + }, + "source": [ + "###TFTTools" + ] }, { "cell_type": "code", "execution_count": null, + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/", + "height": 35 + }, + "id": "pGZQh_V8XLW7", + "outputId": "50ae8107-2d38-42b7-e611-aef9369806de", + "pycharm": { + "name": "#%%\n" + } + }, "outputs": [], "source": [ "class TFTTools(object):\n", @@ -7988,29 +8296,34 @@ " ram_gb = StopWatch.get_sysinfo()[\"mem.available\"]\n", "\n", " print(f'Your runtime has {ram_gb} gigabytes of available RAM\\n')" - ], - "metadata": { - "collapsed": false, - "pycharm": { - "name": "#%%\n" - } - } + ] }, { "cell_type": "markdown", - "source": [ - "### Setup Classic TFT" - ], "metadata": { - "collapsed": false, + "id": "dQCBOqYLXLW8", "pycharm": { "name": "#%% md\n" } - } + }, + "source": [ + "### Setup Classic TFT" + ] }, { "cell_type": "code", "execution_count": null, + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/", + "height": 1251 + }, + "id": "MREcHM73XLW8", + "outputId": "8fb48755-b41a-4fb1-dfb2-8e49fd1dc8a2", + "pycharm": { + "name": "#%%\n" + } + }, "outputs": [], "source": [ "\n", @@ -8047,29 +8360,34 @@ "myTFTTools.PrintTitle('Start TFT')\n", "for k in TFTparams:\n", " print('# {} = {}'.format(k, TFTparams[k]))\n" - ], - "metadata": { - "collapsed": false, - "pycharm": { - "name": "#%%\n" - } - } + ] }, { "cell_type": "markdown", - "source": [ - "###Read TFT Data" - ], "metadata": { - "collapsed": false, + "id": "3andAfJ5XLW8", "pycharm": { "name": "#%% md\n" } - } + }, + "source": [ + "###Read TFT Data" + ] }, { "cell_type": "code", "execution_count": null, + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/", + "height": 966 + }, + "id": "8oir3m8CXLW8", + "outputId": "69b923ed-d1b8-4ed5-beee-3ae0557b2e74", + "pycharm": { + "name": "#%%\n" + } + }, "outputs": [], "source": [ "class TFTDataCache(object):\n", @@ -8315,53 +8633,58 @@ "TFTtrain_datacollection, TFTval_datacollection, TFTtest_datacollection = dothedatasetup()\n", "StopWatch.stop(\"data head setup\")\n", "TFToutput_map = None # holder for final output" - ], - "metadata": { - "collapsed": false, - "pycharm": { - "name": "#%%\n" - } - } + ] }, { "cell_type": "code", "execution_count": null, - "outputs": [], - "source": [], "metadata": { - "collapsed": false, + "id": "e1Q2V-KbXLW8", "pycharm": { "name": "#%%\n" } - } + }, + "outputs": [], + "source": [] }, { "cell_type": "markdown", - "source": [ - "##Predict TFT " - ], "metadata": { - "collapsed": false, + "id": "LSMCG68KXLW8", "pycharm": { "name": "#%% md\n" } - } + }, + "source": [ + "##Predict TFT " + ] }, { "cell_type": "code", "execution_count": null, - "outputs": [], - "source": [], "metadata": { - "collapsed": false, + "id": "DGcL2XunXLW8", "pycharm": { "name": "#%%\n" } - } + }, + "outputs": [], + "source": [] }, { "cell_type": "code", "execution_count": null, + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/", + "height": 35 + }, + "id": "nkNiNNaKXLW8", + "outputId": "e7f13ee1-b3ef-4651-b05c-13c777ccbdb0", + "pycharm": { + "name": "#%%\n" + } + }, "outputs": [], "source": [ "class TFTSaveandInterpret:\n", @@ -8579,31 +8902,36 @@ " self.currentoutput_map = TFTmodelnew.predict(TFTdfTotal, return_targets=False)\n", " self.setFFFFmapping()\n", " return" - ], - "metadata": { - "collapsed": false, - "pycharm": { - "name": "#%%\n" - } - } + ] }, { "cell_type": "markdown", - "source": [ - "###Visualize TFT\n", - "\n", - "Called from finalizeDL" - ], "metadata": { - "collapsed": false, + "id": "QIoysPzcXLW8", "pycharm": { "name": "#%% md\n" } - } + }, + "source": [ + "###Visualize TFT\n", + "\n", + "Called from finalizeDL" + ] }, { "cell_type": "code", "execution_count": null, + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/", + "height": 35 + }, + "id": "KEOBiPldXLW8", + "outputId": "6a8adad5-b04c-4d4b-b61a-c6077e3610cb", + "pycharm": { + "name": "#%%\n" + } + }, "outputs": [], "source": [ "setFFFFmapping_timer = 0\n", @@ -8624,41 +8952,46 @@ " # Input Predictions RawInputPredictionsTOT for DLPrediction are ordered Sequence #, Location but\n", " # Input Predictions ReshapedPredictionsTOT for TFTSaveandInterpret are ordered Location, Sequence#\n", " # Note TFT maximum Sequence # is one larger than FFFFWNPF" - ], - "metadata": { - "collapsed": false, - "pycharm": { - "name": "#%%\n" - } - } + ] }, { "cell_type": "markdown", - "source": [ - "##TFT Routines" - ], "metadata": { - "collapsed": false, + "id": "yDksiF3QXLW8", "pycharm": { "name": "#%% md\n" } - } + }, + "source": [ + "##TFT Routines" + ] }, { "cell_type": "markdown", - "source": [ - "### GLUplusskip: Gated Linear unit plus add and norm with Skip" - ], "metadata": { - "collapsed": false, + "id": "rtgzj7-gXLW9", "pycharm": { "name": "#%% md\n" } - } + }, + "source": [ + "### GLUplusskip: Gated Linear unit plus add and norm with Skip" + ] }, { "cell_type": "code", "execution_count": null, + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/", + "height": 35 + }, + "id": "H3k60rmmXLW9", + "outputId": "921b407f-7868-40d6-aa19-e172b6d84df1", + "pycharm": { + "name": "#%%\n" + } + }, "outputs": [], "source": [ "# GLU with time distribution optional\n", @@ -8737,29 +9070,34 @@ " GLUSkipoutput = self.GateNormalization(GLUSkipoutput)\n", "\n", " return GLUSkipoutput,gated_layer" - ], - "metadata": { - "collapsed": false, - "pycharm": { - "name": "#%%\n" - } - } + ] }, { "cell_type": "markdown", - "source": [ - "###Linear Layer (Dense)" - ], "metadata": { - "collapsed": false, + "id": "RWzIQ9HbXLW9", "pycharm": { "name": "#%% md\n" } - } + }, + "source": [ + "###Linear Layer (Dense)" + ] }, { "cell_type": "code", "execution_count": null, + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/", + "height": 35 + }, + "id": "Tn9qitOlXLW9", + "outputId": "e6ad2e0d-3586-4610-df5b-ee869abc817b", + "pycharm": { + "name": "#%%\n" + } + }, "outputs": [], "source": [ "# Layer utility functions.\n", @@ -8784,29 +9122,34 @@ " n2 = 'LL'+'TD'+LLname\n", " linear = tf.keras.layers.TimeDistributed(linear,name=n2)\n", " return linear" - ], - "metadata": { - "collapsed": false, - "pycharm": { - "name": "#%%\n" - } - } + ] }, { "cell_type": "markdown", - "source": [ - "###Apply MLP" - ], "metadata": { - "collapsed": false, + "id": "IIedNH4kXLW9", "pycharm": { "name": "#%% md\n" } - } + }, + "source": [ + "###Apply MLP" + ] }, { "cell_type": "code", "execution_count": null, + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/", + "height": 35 + }, + "id": "T2bsZJbwXLW9", + "outputId": "d3489644-c3bd-437d-a0b6-33cf19d740c2", + "pycharm": { + "name": "#%%\n" + } + }, "outputs": [], "source": [ "class apply_mlp(tf.keras.layers.Layer):\n", @@ -8849,29 +9192,34 @@ "\n", " hidden = MLPFirstLayer(inputs)\n", " return MLPSecondLayer(hidden)" - ], - "metadata": { - "collapsed": false, - "pycharm": { - "name": "#%%\n" - } - } + ] }, { "cell_type": "markdown", - "source": [ - "###GRN Gated Residual Network" - ], "metadata": { - "collapsed": false, + "id": "YgJmKLyMXLW9", "pycharm": { "name": "#%% md\n" } - } + }, + "source": [ + "###GRN Gated Residual Network" + ] }, { "cell_type": "code", "execution_count": null, + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/", + "height": 35 + }, + "id": "cDGaRb1rXLW9", + "outputId": "a3ef9c2d-a506-4348-d155-5c3eae187cb5", + "pycharm": { + "name": "#%%\n" + } + }, "outputs": [], "source": [ "# GRN Gated Residual Network\n", @@ -8971,29 +9319,34 @@ " return gating_layer, gate\n", " else:\n", " return gating_layer" - ], - "metadata": { - "collapsed": false, - "pycharm": { - "name": "#%%\n" - } - } + ] }, { "cell_type": "markdown", - "source": [ - "###Process Static Variables" - ], "metadata": { - "collapsed": false, + "id": "CwcZpqcdXLW9", "pycharm": { "name": "#%% md\n" } - } + }, + "source": [ + "###Process Static Variables" + ] }, { "cell_type": "code", "execution_count": null, + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/", + "height": 35 + }, + "id": "ZiZmQ6hSXLW9", + "outputId": "3cd44464-8f47-4b3a-aba5-df6657b2db66", + "pycharm": { + "name": "#%%\n" + } + }, "outputs": [], "source": [ "# Process Static inputs in TFT Style\n", @@ -9054,29 +9407,34 @@ " \n", " return static_encoder, sparse_weights\n", "\n" - ], + ] + }, + { + "cell_type": "markdown", "metadata": { - "collapsed": false, + "id": "DNfJTfckXLW9", "pycharm": { - "name": "#%%\n" + "name": "#%% md\n" } - } - }, - { - "cell_type": "markdown", + }, "source": [ "###Process Dynamic Variables" - ], - "metadata": { - "collapsed": false, - "pycharm": { - "name": "#%% md\n" - } - } + ] }, { "cell_type": "code", "execution_count": null, + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/", + "height": 35 + }, + "id": "fbU5P6MwXLW9", + "outputId": "3e91f4b8-666a-4684-ac01-62851d869c0f", + "pycharm": { + "name": "#%%\n" + } + }, "outputs": [], "source": [ "# Process Initial Dynamic inputs in TFT Style\n", @@ -9141,29 +9499,34 @@ "\n", " return temporal_ctx, sparse_weights, static_gate\n", "\n" - ], - "metadata": { - "collapsed": false, - "pycharm": { - "name": "#%%\n" - } - } + ] }, { "cell_type": "markdown", - "source": [ - "###TFT LSTM" - ], "metadata": { - "collapsed": false, + "id": "DuFUCQKuXLW9", "pycharm": { "name": "#%% md\n" } - } + }, + "source": [ + "###TFT LSTM" + ] }, { "cell_type": "code", "execution_count": null, + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/", + "height": 35 + }, + "id": "JrtUONvlXLW9", + "outputId": "8dd6bfb2-0eae-4f4b-adb1-dd42adaac69d", + "pycharm": { + "name": "#%%\n" + } + }, "outputs": [], "source": [ "\n", @@ -9305,29 +9668,34 @@ " def build_graph(self, shapes):\n", " input = tf.keras.layers.Input(shape=shapes, name=\"Input\")\n", " return tf.keras.models.Model(inputs=[input], outputs=[self.call(input)])" - ], - "metadata": { - "collapsed": false, - "pycharm": { - "name": "#%%\n" - } - } + ] }, { "cell_type": "markdown", - "source": [ - "###TFT Multihead Temporal Attention" - ], "metadata": { - "collapsed": false, + "id": "QaqoJS_5XLW-", "pycharm": { "name": "#%% md\n" } - } + }, + "source": [ + "###TFT Multihead Temporal Attention" + ] }, { "cell_type": "code", "execution_count": null, + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/", + "height": 35 + }, + "id": "1tlreK9VXLW-", + "outputId": "b99ee390-d8e6-4c5b-fae3-552a23b42d73", + "pycharm": { + "name": "#%%\n" + } + }, "outputs": [], "source": [ "# Attention Components.\n", @@ -9342,17 +9710,22 @@ " bs = tf.shape(self_attn_inputs)[:1]\n", " mask = tf.math.cumsum(tf.eye(len_s, batch_shape=bs), 1)\n", " return mask" - ], - "metadata": { - "collapsed": false, - "pycharm": { - "name": "#%%\n" - } - } + ] }, { "cell_type": "code", "execution_count": null, + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/", + "height": 35 + }, + "id": "4K-8m66-XLW-", + "outputId": "dea85dc4-a7e7-4869-ee15-bfd0bf7517a4", + "pycharm": { + "name": "#%%\n" + } + }, "outputs": [], "source": [ "class TFTScaledDotProductAttention(tf.keras.Model):\n", @@ -9397,17 +9770,22 @@ " attn = self.dropoutlayer(attn)\n", " output = tf.keras.layers.Lambda(lambda x: tf.keras.backend.batch_dot(x[0], x[1]))([attn, v])\n", " return output, attn" - ], - "metadata": { - "collapsed": false, - "pycharm": { - "name": "#%%\n" - } - } + ] }, { "cell_type": "code", "execution_count": null, + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/", + "height": 35 + }, + "id": "P7X4uRHKXLW-", + "outputId": "fe8bbd06-057c-4d9c-a398-740ebb3ec869", + "pycharm": { + "name": "#%%\n" + } + }, "outputs": [], "source": [ "class TFTInterpretableMultiHeadAttention(tf.keras.Model):\n", @@ -9502,29 +9880,34 @@ " outputs = self.Dropoutlayer2(outputs) # output dropout\n", "\n", " return outputs, attn" - ], - "metadata": { - "collapsed": false, - "pycharm": { - "name": "#%%\n" - } - } + ] }, { "cell_type": "markdown", - "source": [ - "###TFTFullNetwork" - ], "metadata": { - "collapsed": false, + "id": "6ZZf91CuXLW-", "pycharm": { "name": "#%% md\n" } - } + }, + "source": [ + "###TFTFullNetwork" + ] }, { "cell_type": "code", "execution_count": null, + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/", + "height": 35 + }, + "id": "opJMb_5iXLW-", + "outputId": "e794160d-19fc-4661-e739-2e6294b8b276", + "pycharm": { + "name": "#%%\n" + } + }, "outputs": [], "source": [ "class TFTFullNetwork(tf.keras.Model):\n", @@ -9897,41 +10280,46 @@ " outputs = tf.squeeze(outputs, axis=-1)\n", "\n", " return outputs \n" - ], - "metadata": { - "collapsed": false, - "pycharm": { - "name": "#%%\n" - } - } + ] }, { "cell_type": "markdown", - "source": [ - "##TFT Run & Output" - ], "metadata": { - "collapsed": false, + "id": "JFyDa7NOXLW_", "pycharm": { "name": "#%% md\n" } - } + }, + "source": [ + "##TFT Run & Output" + ] }, { "cell_type": "markdown", - "source": [ - "### General Utilities" - ], "metadata": { - "collapsed": false, + "id": "HFkzGoM7XLW_", "pycharm": { "name": "#%% md\n" } - } + }, + "source": [ + "### General Utilities" + ] }, { "cell_type": "code", "execution_count": null, + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/", + "height": 35 + }, + "id": "01PEnmmrXLW_", + "outputId": "ea4db13a-08f3-4417-a41c-52012143dc25", + "pycharm": { + "name": "#%%\n" + } + }, "outputs": [], "source": [ "\n", @@ -10073,29 +10461,34 @@ " \" epochs:\" + str(TFTTransformerepochs))\n", " print(wraptotext(line))\n", " checkNaN(y_predict)" - ], - "metadata": { - "collapsed": false, - "pycharm": { - "name": "#%%\n" - } - } + ] }, { "cell_type": "markdown", - "source": [ - "### Tensorflow Monitor" - ], "metadata": { - "collapsed": false, + "id": "PIutvjH5XLW_", "pycharm": { "name": "#%% md\n" } - } + }, + "source": [ + "### Tensorflow Monitor" + ] }, { "cell_type": "code", "execution_count": null, + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/", + "height": 35 + }, + "id": "fXAbkZxUXLW_", + "outputId": "b8b25d29-6eb3-482f-d114-9cb0ec741f99", + "pycharm": { + "name": "#%%\n" + } + }, "outputs": [], "source": [ "Last_Loss_Best_Loss_event_num=0\n", @@ -10457,29 +10850,34 @@ " StopWatch.event(f\"RunTFTCustomVersion Best Fit event_num:{Best_Fit_event_num}\", values=d)\n", " Best_Fit_event_num+=1\n", " return self.tfepochstep, self.recordtrainloss, self.recordvalloss, self.train_epoch, self.val_epoch " - ], - "metadata": { - "collapsed": false, - "pycharm": { - "name": "#%%\n" - } - } + ] }, { "cell_type": "markdown", - "source": [ - "###TFT Output" - ], "metadata": { - "collapsed": false, + "id": "biQuRNUPXLW_", "pycharm": { "name": "#%% md\n" } - } + }, + "source": [ + "###TFT Output" + ] }, { "cell_type": "code", "execution_count": null, + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/", + "height": 35 + }, + "id": "IgFxLEAhXLW_", + "outputId": "39b21812-08d8-4725-d2bb-52d248acc79e", + "pycharm": { + "name": "#%%\n" + } + }, "outputs": [], "source": [ "def TFTTestpredict(custommodel,datacollection):\n", @@ -10612,31 +11010,36 @@ " VisualizeTFT_timer+=1\n", " else:\n", " printexit(\"unsupported model \" +str(modelflag))\n" - ], - "metadata": { - "collapsed": false, - "pycharm": { - "name": "#%%\n" - } - } + ] }, { "cell_type": "markdown", - "source": [ - "###TFTcustommodel\n", - "\n", - "Control Full TFT Network" - ], "metadata": { - "collapsed": false, + "id": "qDJQXyIfXLW_", "pycharm": { "name": "#%% md\n" } - } + }, + "source": [ + "###TFTcustommodel\n", + "\n", + "Control Full TFT Network" + ] }, { "cell_type": "code", "execution_count": null, + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/", + "height": 35 + }, + "id": "ZC8q8TjiXLW_", + "outputId": "46c0415f-3da4-4102-8a44-fcb506161317", + "pycharm": { + "name": "#%%\n" + } + }, "outputs": [], "source": [ "class TFTcustommodel(tf.keras.Model):\n", @@ -10715,33 +11118,38 @@ " def call(self, inputs, time, identifier, training=None): \n", " predictions = self.myTFTFullNetwork(inputs, time, identifier, training=training)\n", " return predictions" - ], - "metadata": { - "collapsed": false, - "pycharm": { - "name": "#%%\n" - } - } + ] }, { "cell_type": "markdown", + "metadata": { + "id": "cfd1dAivXLXA", + "pycharm": { + "name": "#%% md\n" + } + }, "source": [ "### TFT Overall Batch Training\n", "\n", "* TIME not set explicitly\n", "* Weights allowed or not\n", "* Assumes TFTFullNetwork is full Network" - ], - "metadata": { - "collapsed": false, - "pycharm": { - "name": "#%% md\n" - } - } + ] }, { "cell_type": "code", "execution_count": null, + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/", + "height": 35 + }, + "id": "Sowv5GvAXLXA", + "outputId": "5e585c6a-3e07-4a61-cc8b-62b1d9d85278", + "pycharm": { + "name": "#%%\n" + } + }, "outputs": [], "source": [ "train_Epoch_timer=0\n", @@ -11212,40 +11620,45 @@ "\n", " return\n", "\n" - ], - "metadata": { - "collapsed": false, - "pycharm": { - "name": "#%%\n" - } - } + ] }, { "cell_type": "markdown", - "source": [], "metadata": { - "collapsed": false, + "id": "scUWgNObXLXB", "pycharm": { "name": "#%% md\n" } - } + }, + "source": [] }, { "cell_type": "markdown", - "source": [ - "\n", - "###Run TFT" - ], "metadata": { - "collapsed": false, + "id": "HKXKo9x1XLXC", "pycharm": { "name": "#%% md\n" } - } + }, + "source": [ + "\n", + "###Run TFT" + ] }, { "cell_type": "code", "execution_count": null, + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/", + "height": 269 + }, + "id": "Lo_p8UTfXLXC", + "outputId": "78f99b6d-df8a-4acb-f0e6-774077d29d9a", + "pycharm": { + "name": "#%%\n" + } + }, "outputs": [], "source": [ "# Run TFT Only\n", @@ -11275,17 +11688,22 @@ "TFTTrainingMonitor.SetControlParms(SuccessLimit = 1,FailureLimit = 2)\n", "\n", "TIME_stop(\"RunTFTCustomVersion tft only\")\n" - ], - "metadata": { - "collapsed": false, - "pycharm": { - "name": "#%%\n" - } - } + ] }, { "cell_type": "code", "execution_count": null, + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/", + "height": 35 + }, + "id": "tMXP2Q8-XLXC", + "outputId": "8db1d8fd-b18b-4fe5-9b8c-da5eaa26a192", + "pycharm": { + "name": "#%%\n" + } + }, "outputs": [], "source": [ "def PrintLSTMandBasicStuff(model):\n", @@ -11331,17 +11749,46 @@ " myTFTTools.PrintTitle('Start TFT Deep Learning')\n", " for k in TFTparams:\n", " print('# {} = {}'.format(k, TFTparams[k]))\n" - ], - "metadata": { - "collapsed": false, - "pycharm": { - "name": "#%%\n" - } - } + ] }, { "cell_type": "code", "execution_count": null, + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/", + "height": 6459, + "referenced_widgets": [ + "0af52ed551474963aa45a746578a03d9", + "22581fcbb7ba4490a2e17a4d1e92a991", + "dcf254d4a2cb4104ac994320560f5d6b", + "d67f2929a1d748ed9b1661dcf24879f1", + "5a5c1e8b3be34626825e39a0b064efa6", + "88c255c36704429f9e99cb1604bd0f5a", + "51a1d801fe4d453cb3e7c7ef949fd097", + "a69bac309f854735ae822ea30f8de6fe", + "44306333a81143c58e6bb6018e878133", + "6ee47c910b1c4e17ae70ac5210a12671", + "2c826318c54940f59f82fac92f93e269", + "3e7bb0ee50e045c39d8f5a377a913ba7", + "2f00adcabf904cefad675a7d88600ce7", + "9a2c44f6d8fe481b860480b3095d42be", + "50b03d3bf8cf42b6a663e7e88867b53b", + "40a3ae60fb4e46fa8e59665d849fa4dc", + "7201a05206cf448cb2d3f05664098b94", + "1fb18d258d944621981059d993d8da19", + "79548e2f76f44944b41f106d635c611c", + "53beeb68058744f089907579e62a55b8", + "a06100a61a5a484eb88684d0bac0c50d", + "2ac40ee5c1e24322a799084bccd4e5f7" + ] + }, + "id": "oI_EwHw2XLXC", + "outputId": "118c5037-c9d5-4590-e939-a1c575048dd8", + "pycharm": { + "name": "#%%\n" + } + }, "outputs": [], "source": [ "TIME_start(\"RunTFTCustomVersion print\")\n", @@ -11357,32 +11804,32 @@ "RunTFTCustomVersion()\n", "myTFTTools.PrintTitle('TFT run completed')\n", "TIME_stop(\"RunTFTCustomVersion A\")" - ], - "metadata": { - "collapsed": false, - "pycharm": { - "name": "#%%\n" - } - } + ] }, { "cell_type": "code", "execution_count": null, - "outputs": [], - "source": [ - "StopWatch.stop(\"total\", mllog_key=\"RUN_STOP\")\n", - "StopWatch.benchmark()" - ], "metadata": { - "collapsed": false, + "id": "jglO-K9fXLXC", "pycharm": { "name": "#%%\n" } - } + }, + "outputs": [], + "source": [ + "StopWatch.stop(\"total\", mllog_key=\"RUN_STOP\")\n", + "StopWatch.benchmark()" + ] }, { "cell_type": "code", "execution_count": null, + "metadata": { + "id": "xtA1e-zpXLXC", + "pycharm": { + "name": "#%%\n" + } + }, "outputs": [], "source": [ "import re\n", @@ -11408,18 +11855,13 @@ " print('Card = ' + str(config.card_name))\n", " print(\"Partition is \" + str(os.getenv('SLURM_JOB_PARTITION')))\n", " print(\"Job ID is \" + str(os.getenv(\"SLURM_JOB_ID\")))" - ], - "metadata": { - "collapsed": false, - "pycharm": { - "name": "#%%\n" - } - } + ] }, { "cell_type": "code", "execution_count": null, "metadata": { + "id": "OO8ly1e5XLXC", "pycharm": { "is_executing": true, "name": "#%%\n" @@ -11441,11 +11883,21 @@ "source": [ "#End modified TFT" ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "VY72tcRu0APK" + }, + "outputs": [], + "source": [] } ], "metadata": { "accelerator": "GPU", "colab": { + "background_execution": "on", "collapsed_sections": [ "6CdCNdQ_yGWV" ], @@ -11453,6 +11905,7 @@ "name": "FFFFWNPFEARTHQ-newTFTv29", "provenance": [] }, + "gpuClass": "standard", "kernelspec": { "display_name": "Python 3 (ipykernel)", "language": "python", @@ -11468,11 +11921,69 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.10.4" + "version": "3.8.11" }, "widgets": { "application/vnd.jupyter.widget-state+json": { - "04db645a3ea4484687590011b78cf901": { + "0af52ed551474963aa45a746578a03d9": { + "model_module": "@jupyter-widgets/controls", + "model_module_version": "1.5.0", + "model_name": "HBoxModel", + "state": { + "_dom_classes": [], + "_model_module": "@jupyter-widgets/controls", + "_model_module_version": "1.5.0", + "_model_name": "HBoxModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/controls", + "_view_module_version": "1.5.0", + "_view_name": "HBoxView", + "box_style": "", + "children": [ + "IPY_MODEL_22581fcbb7ba4490a2e17a4d1e92a991", + "IPY_MODEL_dcf254d4a2cb4104ac994320560f5d6b", + "IPY_MODEL_d67f2929a1d748ed9b1661dcf24879f1" + ], + "layout": "IPY_MODEL_5a5c1e8b3be34626825e39a0b064efa6" + } + }, + "1fb18d258d944621981059d993d8da19": { + "model_module": "@jupyter-widgets/controls", + "model_module_version": "1.5.0", + "model_name": "DescriptionStyleModel", + "state": { + "_model_module": "@jupyter-widgets/controls", + "_model_module_version": "1.5.0", + "_model_name": "DescriptionStyleModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/base", + "_view_module_version": "1.2.0", + "_view_name": "StyleView", + "description_width": "" + } + }, + "22581fcbb7ba4490a2e17a4d1e92a991": { + "model_module": "@jupyter-widgets/controls", + "model_module_version": "1.5.0", + "model_name": "HTMLModel", + "state": { + "_dom_classes": [], + "_model_module": "@jupyter-widgets/controls", + "_model_module_version": "1.5.0", + "_model_name": "HTMLModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/controls", + "_view_module_version": "1.5.0", + "_view_name": "HTMLView", + "description": "", + "description_tooltip": null, + "layout": "IPY_MODEL_88c255c36704429f9e99cb1604bd0f5a", + "placeholder": "​", + "style": "IPY_MODEL_51a1d801fe4d453cb3e7c7ef949fd097", + "value": "Training loop: 50%" + } + }, + "2ac40ee5c1e24322a799084bccd4e5f7": { "model_module": "@jupyter-widgets/controls", "model_module_version": "1.5.0", "model_name": "DescriptionStyleModel", @@ -11487,7 +11998,43 @@ "description_width": "" } }, - "0634f0a96f5d406cae0d78a1b8f24346": { + "2c826318c54940f59f82fac92f93e269": { + "model_module": "@jupyter-widgets/controls", + "model_module_version": "1.5.0", + "model_name": "DescriptionStyleModel", + "state": { + "_model_module": "@jupyter-widgets/controls", + "_model_module_version": "1.5.0", + "_model_name": "DescriptionStyleModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/base", + "_view_module_version": "1.2.0", + "_view_name": "StyleView", + "description_width": "" + } + }, + "2f00adcabf904cefad675a7d88600ce7": { + "model_module": "@jupyter-widgets/controls", + "model_module_version": "1.5.0", + "model_name": "HTMLModel", + "state": { + "_dom_classes": [], + "_model_module": "@jupyter-widgets/controls", + "_model_module_version": "1.5.0", + "_model_name": "HTMLModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/controls", + "_view_module_version": "1.5.0", + "_view_name": "HTMLView", + "description": "", + "description_tooltip": null, + "layout": "IPY_MODEL_7201a05206cf448cb2d3f05664098b94", + "placeholder": "​", + "style": "IPY_MODEL_1fb18d258d944621981059d993d8da19", + "value": "Batch loop: 79%" + } + }, + "3e7bb0ee50e045c39d8f5a377a913ba7": { "model_module": "@jupyter-widgets/controls", "model_module_version": "1.5.0", "model_name": "HBoxModel", @@ -11502,14 +12049,14 @@ "_view_name": "HBoxView", "box_style": "", "children": [ - "IPY_MODEL_d03038f77d084d1b9b0e4f42b2ebb622", - "IPY_MODEL_9b04396d9eb2420e9259b8573eef3b70", - "IPY_MODEL_c23fefbc3cdd4ad38d1eb3f741ab1f51" + "IPY_MODEL_2f00adcabf904cefad675a7d88600ce7", + "IPY_MODEL_9a2c44f6d8fe481b860480b3095d42be", + "IPY_MODEL_50b03d3bf8cf42b6a663e7e88867b53b" ], - "layout": "IPY_MODEL_f28ff11c09ab4843bfaacf725b997f95" + "layout": "IPY_MODEL_40a3ae60fb4e46fa8e59665d849fa4dc" } }, - "0a1d9b55698544a581539f34595b7755": { + "40a3ae60fb4e46fa8e59665d849fa4dc": { "model_module": "@jupyter-widgets/base", "model_module_version": "1.2.0", "model_name": "LayoutModel", @@ -11561,7 +12108,75 @@ "width": null } }, - "4c5a70fcb0e64de5892f41aabba46b81": { + "44306333a81143c58e6bb6018e878133": { + "model_module": "@jupyter-widgets/controls", + "model_module_version": "1.5.0", + "model_name": "ProgressStyleModel", + "state": { + "_model_module": "@jupyter-widgets/controls", + "_model_module_version": "1.5.0", + "_model_name": "ProgressStyleModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/base", + "_view_module_version": "1.2.0", + "_view_name": "StyleView", + "bar_color": null, + "description_width": "" + } + }, + "50b03d3bf8cf42b6a663e7e88867b53b": { + "model_module": "@jupyter-widgets/controls", + "model_module_version": "1.5.0", + "model_name": "HTMLModel", + "state": { + "_dom_classes": [], + "_model_module": "@jupyter-widgets/controls", + "_model_module_version": "1.5.0", + "_model_name": "HTMLModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/controls", + "_view_module_version": "1.5.0", + "_view_name": "HTMLView", + "description": "", + "description_tooltip": null, + "layout": "IPY_MODEL_a06100a61a5a484eb88684d0bac0c50d", + "placeholder": "​", + "style": "IPY_MODEL_2ac40ee5c1e24322a799084bccd4e5f7", + "value": " 688704/875000 [12:53<03:25, 904.75sample/s, Epoch=1, Loss=0.0866]" + } + }, + "51a1d801fe4d453cb3e7c7ef949fd097": { + "model_module": "@jupyter-widgets/controls", + "model_module_version": "1.5.0", + "model_name": "DescriptionStyleModel", + "state": { + "_model_module": "@jupyter-widgets/controls", + "_model_module_version": "1.5.0", + "_model_name": "DescriptionStyleModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/base", + "_view_module_version": "1.2.0", + "_view_name": "StyleView", + "description_width": "" + } + }, + "53beeb68058744f089907579e62a55b8": { + "model_module": "@jupyter-widgets/controls", + "model_module_version": "1.5.0", + "model_name": "ProgressStyleModel", + "state": { + "_model_module": "@jupyter-widgets/controls", + "_model_module_version": "1.5.0", + "_model_name": "ProgressStyleModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/base", + "_view_module_version": "1.2.0", + "_view_name": "StyleView", + "bar_color": null, + "description_width": "" + } + }, + "5a5c1e8b3be34626825e39a0b064efa6": { "model_module": "@jupyter-widgets/base", "model_module_version": "1.2.0", "model_name": "LayoutModel", @@ -11613,104 +12228,239 @@ "width": null } }, - "9b04396d9eb2420e9259b8573eef3b70": { - "model_module": "@jupyter-widgets/controls", - "model_module_version": "1.5.0", - "model_name": "FloatProgressModel", + "6ee47c910b1c4e17ae70ac5210a12671": { + "model_module": "@jupyter-widgets/base", + "model_module_version": "1.2.0", + "model_name": "LayoutModel", "state": { - "_dom_classes": [], - "_model_module": "@jupyter-widgets/controls", - "_model_module_version": "1.5.0", - "_model_name": "FloatProgressModel", + "_model_module": "@jupyter-widgets/base", + "_model_module_version": "1.2.0", + "_model_name": "LayoutModel", "_view_count": null, - "_view_module": "@jupyter-widgets/controls", - "_view_module_version": "1.5.0", - "_view_name": "ProgressView", - "bar_style": "", - "description": "", - "description_tooltip": null, - "layout": "IPY_MODEL_4c5a70fcb0e64de5892f41aabba46b81", - "max": 1775, - "min": 0, - "orientation": "horizontal", - "style": "IPY_MODEL_ce660d6f798d472199837af0be65be0a", - "value": 1775 + "_view_module": "@jupyter-widgets/base", + "_view_module_version": "1.2.0", + "_view_name": "LayoutView", + "align_content": null, + "align_items": null, + "align_self": null, + "border": null, + "bottom": null, + "display": null, + "flex": null, + "flex_flow": null, + "grid_area": null, + "grid_auto_columns": null, + "grid_auto_flow": null, + "grid_auto_rows": null, + "grid_column": null, + "grid_gap": null, + "grid_row": null, + "grid_template_areas": null, + "grid_template_columns": null, + "grid_template_rows": null, + "height": null, + "justify_content": null, + "justify_items": null, + "left": null, + "margin": null, + "max_height": null, + "max_width": null, + "min_height": null, + "min_width": null, + "object_fit": null, + "object_position": null, + "order": null, + "overflow": null, + "overflow_x": null, + "overflow_y": null, + "padding": null, + "right": null, + "top": null, + "visibility": null, + "width": null } }, - "bcee1a2685974293af383558e636e347": { - "model_module": "@jupyter-widgets/controls", - "model_module_version": "1.5.0", - "model_name": "DescriptionStyleModel", + "7201a05206cf448cb2d3f05664098b94": { + "model_module": "@jupyter-widgets/base", + "model_module_version": "1.2.0", + "model_name": "LayoutModel", "state": { - "_model_module": "@jupyter-widgets/controls", - "_model_module_version": "1.5.0", - "_model_name": "DescriptionStyleModel", + "_model_module": "@jupyter-widgets/base", + "_model_module_version": "1.2.0", + "_model_name": "LayoutModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", - "_view_name": "StyleView", - "description_width": "" + "_view_name": "LayoutView", + "align_content": null, + "align_items": null, + "align_self": null, + "border": null, + "bottom": null, + "display": null, + "flex": null, + "flex_flow": null, + "grid_area": null, + "grid_auto_columns": null, + "grid_auto_flow": null, + "grid_auto_rows": null, + "grid_column": null, + "grid_gap": null, + "grid_row": null, + "grid_template_areas": null, + "grid_template_columns": null, + "grid_template_rows": null, + "height": null, + "justify_content": null, + "justify_items": null, + "left": null, + "margin": null, + "max_height": null, + "max_width": null, + "min_height": null, + "min_width": null, + "object_fit": null, + "object_position": null, + "order": null, + "overflow": null, + "overflow_x": null, + "overflow_y": null, + "padding": null, + "right": null, + "top": null, + "visibility": null, + "width": null } }, - "c23fefbc3cdd4ad38d1eb3f741ab1f51": { - "model_module": "@jupyter-widgets/controls", - "model_module_version": "1.5.0", - "model_name": "HTMLModel", + "79548e2f76f44944b41f106d635c611c": { + "model_module": "@jupyter-widgets/base", + "model_module_version": "1.2.0", + "model_name": "LayoutModel", "state": { - "_dom_classes": [], - "_model_module": "@jupyter-widgets/controls", - "_model_module_version": "1.5.0", - "_model_name": "HTMLModel", + "_model_module": "@jupyter-widgets/base", + "_model_module_version": "1.2.0", + "_model_name": "LayoutModel", "_view_count": null, - "_view_module": "@jupyter-widgets/controls", - "_view_module_version": "1.5.0", - "_view_name": "HTMLView", - "description": "", - "description_tooltip": null, - "layout": "IPY_MODEL_decf3f3a60c3460694dab0bd74a621a5", - "placeholder": "​", - "style": "IPY_MODEL_bcee1a2685974293af383558e636e347", - "value": " 1775/1775 [30:38<00:00, 4.73sequences/s, Call=1775, TotalLoss=0.00525]" + "_view_module": "@jupyter-widgets/base", + "_view_module_version": "1.2.0", + "_view_name": "LayoutView", + "align_content": null, + "align_items": null, + "align_self": null, + "border": null, + "bottom": null, + "display": null, + "flex": null, + "flex_flow": null, + "grid_area": null, + "grid_auto_columns": null, + "grid_auto_flow": null, + "grid_auto_rows": null, + "grid_column": null, + "grid_gap": null, + "grid_row": null, + "grid_template_areas": null, + "grid_template_columns": null, + "grid_template_rows": null, + "height": null, + "justify_content": null, + "justify_items": null, + "left": null, + "margin": null, + "max_height": null, + "max_width": null, + "min_height": null, + "min_width": null, + "object_fit": null, + "object_position": null, + "order": null, + "overflow": null, + "overflow_x": null, + "overflow_y": null, + "padding": null, + "right": null, + "top": null, + "visibility": null, + "width": null } }, - "ce660d6f798d472199837af0be65be0a": { - "model_module": "@jupyter-widgets/controls", - "model_module_version": "1.5.0", - "model_name": "ProgressStyleModel", + "88c255c36704429f9e99cb1604bd0f5a": { + "model_module": "@jupyter-widgets/base", + "model_module_version": "1.2.0", + "model_name": "LayoutModel", "state": { - "_model_module": "@jupyter-widgets/controls", - "_model_module_version": "1.5.0", - "_model_name": "ProgressStyleModel", + "_model_module": "@jupyter-widgets/base", + "_model_module_version": "1.2.0", + "_model_name": "LayoutModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", - "_view_name": "StyleView", - "bar_color": null, - "description_width": "" + "_view_name": "LayoutView", + "align_content": null, + "align_items": null, + "align_self": null, + "border": null, + "bottom": null, + "display": null, + "flex": null, + "flex_flow": null, + "grid_area": null, + "grid_auto_columns": null, + "grid_auto_flow": null, + "grid_auto_rows": null, + "grid_column": null, + "grid_gap": null, + "grid_row": null, + "grid_template_areas": null, + "grid_template_columns": null, + "grid_template_rows": null, + "height": null, + "justify_content": null, + "justify_items": null, + "left": null, + "margin": null, + "max_height": null, + "max_width": null, + "min_height": null, + "min_width": null, + "object_fit": null, + "object_position": null, + "order": null, + "overflow": null, + "overflow_x": null, + "overflow_y": null, + "padding": null, + "right": null, + "top": null, + "visibility": null, + "width": null } }, - "d03038f77d084d1b9b0e4f42b2ebb622": { + "9a2c44f6d8fe481b860480b3095d42be": { "model_module": "@jupyter-widgets/controls", "model_module_version": "1.5.0", - "model_name": "HTMLModel", + "model_name": "FloatProgressModel", "state": { "_dom_classes": [], "_model_module": "@jupyter-widgets/controls", "_model_module_version": "1.5.0", - "_model_name": "HTMLModel", + "_model_name": "FloatProgressModel", "_view_count": null, "_view_module": "@jupyter-widgets/controls", "_view_module_version": "1.5.0", - "_view_name": "HTMLView", + "_view_name": "ProgressView", + "bar_style": "", "description": "", "description_tooltip": null, - "layout": "IPY_MODEL_0a1d9b55698544a581539f34595b7755", - "placeholder": "​", - "style": "IPY_MODEL_04db645a3ea4484687590011b78cf901", - "value": "Predict loop: 100%" + "layout": "IPY_MODEL_79548e2f76f44944b41f106d635c611c", + "max": 875000, + "min": 0, + "orientation": "horizontal", + "style": "IPY_MODEL_53beeb68058744f089907579e62a55b8", + "value": 688704 } }, - "decf3f3a60c3460694dab0bd74a621a5": { + "a06100a61a5a484eb88684d0bac0c50d": { "model_module": "@jupyter-widgets/base", "model_module_version": "1.2.0", "model_name": "LayoutModel", @@ -11762,7 +12512,7 @@ "width": null } }, - "f28ff11c09ab4843bfaacf725b997f95": { + "a69bac309f854735ae822ea30f8de6fe": { "model_module": "@jupyter-widgets/base", "model_module_version": "1.2.0", "model_name": "LayoutModel", @@ -11813,10 +12563,55 @@ "visibility": null, "width": null } + }, + "d67f2929a1d748ed9b1661dcf24879f1": { + "model_module": "@jupyter-widgets/controls", + "model_module_version": "1.5.0", + "model_name": "HTMLModel", + "state": { + "_dom_classes": [], + "_model_module": "@jupyter-widgets/controls", + "_model_module_version": "1.5.0", + "_model_name": "HTMLModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/controls", + "_view_module_version": "1.5.0", + "_view_name": "HTMLView", + "description": "", + "description_tooltip": null, + "layout": "IPY_MODEL_6ee47c910b1c4e17ae70ac5210a12671", + "placeholder": "​", + "style": "IPY_MODEL_2c826318c54940f59f82fac92f93e269", + "value": " 1/2 [15:08<15:08, 908.48s/epoch, Loss=0.2, Val=0.0549]" + } + }, + "dcf254d4a2cb4104ac994320560f5d6b": { + "model_module": "@jupyter-widgets/controls", + "model_module_version": "1.5.0", + "model_name": "FloatProgressModel", + "state": { + "_dom_classes": [], + "_model_module": "@jupyter-widgets/controls", + "_model_module_version": "1.5.0", + "_model_name": "FloatProgressModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/controls", + "_view_module_version": "1.5.0", + "_view_name": "ProgressView", + "bar_style": "", + "description": "", + "description_tooltip": null, + "layout": "IPY_MODEL_a69bac309f854735ae822ea30f8de6fe", + "max": 2, + "min": 0, + "orientation": "horizontal", + "style": "IPY_MODEL_44306333a81143c58e6bb6018e878133", + "value": 1 + } } } } }, "nbformat": 4, "nbformat_minor": 4 -} \ No newline at end of file +} From 136fe2800a424fee863ee0c1fd8506f34a248fc7 Mon Sep 17 00:00:00 2001 From: Jake Kolessar Date: Sat, 6 Aug 2022 09:08:54 -0400 Subject: [PATCH 2/2] Cleaned up comments --- .../FFFFWNPFEARTHQ_newTFTv29-gregor-parameters-fig.ipynb | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/benchmarks/earthquake/latest/FFFFWNPFEARTHQ_newTFTv29-gregor-parameters-fig.ipynb b/benchmarks/earthquake/latest/FFFFWNPFEARTHQ_newTFTv29-gregor-parameters-fig.ipynb index 849e1e75..2e84501f 100644 --- a/benchmarks/earthquake/latest/FFFFWNPFEARTHQ_newTFTv29-gregor-parameters-fig.ipynb +++ b/benchmarks/earthquake/latest/FFFFWNPFEARTHQ_newTFTv29-gregor-parameters-fig.ipynb @@ -33,7 +33,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 1, "metadata": { "cellView": "form", "id": "jmjh290raIky", @@ -79,7 +79,6 @@ "\n", "if in_colab:\n", " # Avoids scroll-in-the-scroll in the entire Notebook\n", - " #test\n", " from IPython.display import Javascript\n", " def resize_colab_cell():\n", " display(Javascript('google.colab.output.setIframeHeight(0, true, {maxHeight: 20000})'))\n", @@ -92,8 +91,6 @@ " !wget --no-check-certificate --content-disposition https://raw.githubusercontent.com/laszewsk/mlcommons/main/benchmarks/earthquake/latest/experiments/rivanna-2epoch/rivanna-2epoch.yaml\n", " !mv rivanna-2epoch.yaml config.yaml\n", " !echo 'system.host: colab' >> config.yaml\n", - " #!mkdir ColabDatasets/\n", - " #!cd /content/gdrive/MyDrive/ColabDatasets/\n", " !git clone https://github.com/laszewsk/mlcommons-data-earthquake.git mlcommons-data-earthquake\n", " !tar Jxvf mlcommons-data-earthquake/data.tar.xz -C ." ]