4 "cell_type": "markdown",
5 "id": "e20166f4-1a8b-4471-a9a9-e944cc4b1087",
8 "# Use to Check Reproducibility - v2.1 Code\n",
10 "Version 2.1 relies on conda environment built from yaml file `fmda/install/fmda_ml.yml`. This environment uses python version `>=3.12` tensorflow version `>=2.16`. This led to substantial changes from the old reproducibility for code v2.0, so those old reproducibility hashes are no longer supported.\n",
12 "To see old code and reproduciblity results, see commit \"911c6d7a\" or PR#11."
16 "cell_type": "markdown",
17 "id": "ccbfa419-70b9-484f-ada7-82fcc70b5b38",
25 "execution_count": null,
26 "id": "8530bc7e-61ae-4463-a14f-d5eb42f0b83e",
31 "import numpy as np\n",
32 "import pandas as pd\n",
33 "import tensorflow as tf\n",
34 "import matplotlib.pyplot as plt\n",
37 "sys.path.append('..')\n",
38 "from moisture_rnn import RNN, RNNParams, RNNData\n",
39 "import reproducibility\n",
40 "from utils import print_dict_summary, read_yml, read_pkl\n",
41 "from moisture_rnn_pkl import pkl2train\n",
42 "from moisture_rnn import RNN, RNNData, RNNParams\n",
44 "from utils import logging_setup\n",
49 "cell_type": "markdown",
50 "id": "63d275da-b13a-405e-9e1a-aa3f972119b5",
53 "### Reproducibility Dataset"
58 "execution_count": null,
59 "id": "2dfa08fa-01c9-4fd7-927b-541b0a532e4f",
64 "repro_file='../data/reproducibility_dict_v2_TEST.pkl'\n",
65 "repro = read_pkl(repro_file)"
69 "cell_type": "markdown",
70 "id": "87f59db1-fa7b-44f4-bbe4-7e49221226e9",
73 "## RNN with Stateful Batch Training\n"
78 "execution_count": null,
79 "id": "134d13b9-f329-49fb-8b53-16b4b109ae18",
84 "params = repro['repro_info']['params']\n",
85 "print(type(params))\n",
91 "execution_count": null,
92 "id": "e9867f1b-f0fe-4032-a302-ec093782b227",
96 "# Set up input data\n",
97 "rnn_dat = RNNData(repro, scaler = params['scaler'], features_list = params['features_list'])\n",
98 "rnn_dat.train_test_split(\n",
99 " train_frac = params['train_frac'],\n",
100 " val_frac = params['val_frac']\n",
102 "rnn_dat.scale_data()"
107 "execution_count": null,
108 "id": "458ea3bb-2b19-42b3-8ac8-fdec96c6d315",
112 "reproducibility.set_seed()\n",
113 "rnn = RNN(params)\n",
114 "m, errs = rnn.run_model(rnn_dat, reproducibility_run=True)"
119 "execution_count": null,
120 "id": "ac65f5e4-b9a6-4592-998c-3e5161125449",
127 "execution_count": null,
128 "id": "0e66d653-92d9-40cb-8690-dc9aa9c7b504",
135 "execution_count": null,
136 "id": "591cd4d8-8b15-4d94-b258-76e92176f298",
143 "execution_count": null,
144 "id": "67b6d000-b41b-4d5f-bead-814167e79fce",
150 "cell_type": "markdown",
151 "id": "d4103c38-e067-4e72-a694-27080fa5265e",
154 "### Physics Initialized"
159 "execution_count": null,
160 "id": "383e2870-a581-4ac2-8669-f16ac41a64a4",
164 "print(\"NOT YET IMPLEMENTED\")\n",
165 "# params.update({'phys_initialize': True})\n",
166 "# reproducibility.set_seed()\n",
167 "# rnn = RNN(params)\n",
168 "# m, errs = rnn.run_model(rnn_dat)"
173 "execution_count": null,
174 "id": "33584d39-cd5d-4613-b330-48ab960cb42e",
181 "execution_count": null,
182 "id": "9bfbd951-c89a-4b69-be94-7ac4783f5eb7",
190 "display_name": "Python 3 (ipykernel)",
191 "language": "python",
199 "file_extension": ".py",
200 "mimetype": "text/x-python",
202 "nbconvert_exporter": "python",
203 "pygments_lexer": "ipython3",