Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
218 commits
Select commit Hold shift + click to select a range
9d81107
add read_train_data function to the analysis.evaluation module, and a…
tommylees112 Oct 14, 2019
fb4e96c
update the spatial_rmse to correct falsely indexed xarray objects (tr…
tommylees112 Oct 15, 2019
037cec5
vscode hidden dir
tommylees112 Oct 21, 2019
f70028c
unfinished evaluation
tommylees112 Oct 21, 2019
efa2515
Merge branch 'master' of https://github.com/esowc/ml_drought into ana…
tommylees112 Nov 1, 2019
6cf6036
read_train / read_test data
tommylees112 Nov 1, 2019
2b45da9
remove coverage files
tommylees112 Nov 1, 2019
19f99ef
add ignore_vars to models
tommylees112 Nov 1, 2019
4bbca0b
improve the comparison for spatial_rmse
tommylees112 Nov 4, 2019
87acdeb
add africa to region
tommylees112 Nov 13, 2019
4c3dc7e
add pretrained option to all models
tommylees112 Nov 13, 2019
6a2d2b9
notebook tests
tommylees112 Nov 13, 2019
47e9409
spatial plot kwargs
tommylees112 Nov 13, 2019
8d0b4c4
update get metric to take spatial kwags
tommylees112 Nov 13, 2019
0266424
add argument names to model call
tommylees112 Nov 13, 2019
ce44497
update nb1
tommylees112 Nov 20, 2019
ad9fcbf
update notebooks
tommylees112 Nov 21, 2019
96a170d
Merge branch 'master' of https://github.com/esowc/ml_drought into ana…
tommylees112 Nov 21, 2019
80b2ee7
update notebook
tommylees112 Nov 22, 2019
bdaf5a6
vscode settings
tommylees112 Nov 26, 2019
0d264b0
update esa cci preprocess
tommylees112 Nov 27, 2019
562d47e
update notebook
tommylees112 Nov 28, 2019
512f7e2
add true_data_path to evaluate month
tommylees112 Dec 2, 2019
654cb85
update docstring
tommylees112 Dec 2, 2019
1ac2453
update the mypy args
tommylees112 Dec 2, 2019
72b8059
annual_scores needs to take LIST of PRED YEARS
tommylees112 Dec 2, 2019
7674424
notebooks
tommylees112 Dec 2, 2019
704eb5d
notebook
tommylees112 Dec 5, 2019
aa0e93a
assert to catch errors
tommylees112 Dec 5, 2019
f03541c
update notebook
tommylees112 Dec 5, 2019
dbe7807
notebook
tommylees112 Dec 5, 2019
7d2d85f
update notebooks
tommylees112 Dec 18, 2019
e62f4e4
initial changes (INCOMPLETE)
tommylees112 Dec 18, 2019
03074eb
update all models for calculating derivatives
tommylees112 Dec 18, 2019
331107c
change to name predict delta
tommylees112 Dec 27, 2019
c0e7227
get evaluate working for predict_delta
tommylees112 Dec 28, 2019
73aa5fa
remove blank line from end of file
tommylees112 Dec 28, 2019
9cdb234
add predict_delta scripts
tommylees112 Dec 28, 2019
e3bc721
update path to models
tommylees112 Dec 28, 2019
1fc570d
reduce number of warnings from data
tommylees112 Dec 28, 2019
421e7ea
fix black and mypy errors
tommylees112 Dec 28, 2019
ae83f27
fix black errors
tommylees112 Dec 28, 2019
3f9fb28
remove 'hello' from tests
tommylees112 Dec 28, 2019
6d2d667
add comments to update where failing
tommylees112 Jan 3, 2020
038f8c0
update script to test quickly
tommylees112 Jan 6, 2020
00580c2
model base work without new dataloader
tommylees112 Jan 6, 2020
e4254bd
new attributes to data.py & update tests
tommylees112 Jan 6, 2020
2fbd75f
comments to base.py
tommylees112 Jan 6, 2020
8ab7521
update test base to test evaluate
tommylees112 Jan 6, 2020
8e4566e
update models to calculate predict_delta
tommylees112 Jan 6, 2020
831b8af
black the code
tommylees112 Jan 6, 2020
40cdc49
remove nan indices from the numpy data
tommylees112 Jan 6, 2020
93348d8
add y_var to the test_arrays_dict
tommylees112 Jan 6, 2020
8b97d75
flatten historcial_arrays shape
tommylees112 Jan 6, 2020
99d315d
update the assert statement
tommylees112 Jan 6, 2020
68f77e7
update flake errors
tommylees112 Jan 6, 2020
7364adf
update shutil to capture shutil error
tommylees112 Jan 6, 2020
ec2eca1
quick error to test the pred_delta is working
tommylees112 Jan 6, 2020
b438967
remove assert False
tommylees112 Jan 6, 2020
9ce61d9
add time to the rename directory function
tommylees112 Jan 6, 2020
d73146a
add datetime argument
tommylees112 Jan 6, 2020
96e1799
remove unnecessary import
tommylees112 Jan 6, 2020
cf1fe7b
fix different variables experiment
tommylees112 Jan 6, 2020
6938d98
run only from where it broke
tommylees112 Jan 6, 2020
d821142
black the scripts
tommylees112 Jan 6, 2020
53b1891
update the tests to work
tommylees112 Jan 6, 2020
af00731
blackify the code
tommylees112 Jan 6, 2020
9607e5f
Merge branch 'master' of https://github.com/esowc/ml_drought into ana…
tommylees112 Jan 6, 2020
3792b22
Merge branch 'models/derivative' of https://github.com/esowc/ml_droug…
tommylees112 Jan 6, 2020
7aafb91
update pytest failures
tommylees112 Jan 6, 2020
f608620
blackify
tommylees112 Jan 6, 2020
84765f1
mypy fix
tommylees112 Jan 6, 2020
fb82947
start the training period experiment
tommylees112 Jan 6, 2020
8c8f955
update training period experiments
tommylees112 Jan 8, 2020
fdd5ee1
initial commit to experiment trying to include train_years
tommylees112 Jan 9, 2020
685e25e
get experiment working
tommylees112 Jan 10, 2020
c4d4918
update engineer
tommylees112 Jan 10, 2020
0407715
update script for test
tommylees112 Jan 10, 2020
e2a32fb
update script for test
tommylees112 Jan 10, 2020
21cff4b
update script for test
tommylees112 Jan 10, 2020
84e3122
pull from analysis/load_historical
tommylees112 Jan 10, 2020
8956bd4
black 02 scripts file
tommylees112 Jan 10, 2020
299eba9
fix 02 script imports
tommylees112 Jan 10, 2020
818743e
fix 02 script imports
tommylees112 Jan 10, 2020
4c568f5
fix 02 script imports
tommylees112 Jan 10, 2020
e9fe938
fix 02 script imports
tommylees112 Jan 10, 2020
5167fbe
fix 02 script imports
tommylees112 Jan 10, 2020
4b125fe
fix 02 script imports
tommylees112 Jan 10, 2020
27c3399
update 01 to not rerun already run experiments
tommylees112 Jan 10, 2020
3e20dbd
update and fix engineer
tommylees112 Jan 10, 2020
47e245b
update and fix engineer
tommylees112 Jan 10, 2020
5aaa70d
update and fix engineer
tommylees112 Jan 10, 2020
952f1fd
try to get experiment to work
tommylees112 Jan 10, 2020
18ef005
try to get experiment to work
tommylees112 Jan 10, 2020
be440ab
try to get experiment to work
tommylees112 Jan 10, 2020
c380b86
try to get experiment to work
tommylees112 Jan 10, 2020
0161b06
try to get experiment to work
tommylees112 Jan 10, 2020
cb29a7a
try to get experiment to work
tommylees112 Jan 10, 2020
5af0bfe
try to get experiment to work
tommylees112 Jan 10, 2020
b1a9e05
try to get experiment to work
tommylees112 Jan 10, 2020
af89775
try to get experiment to work
tommylees112 Jan 10, 2020
16c02d9
try to get experiment to work
tommylees112 Jan 10, 2020
9c0725b
try to get experiment to work
tommylees112 Jan 10, 2020
8169c89
try to get experiment to work
tommylees112 Jan 10, 2020
fac1144
try to get experiment to work
tommylees112 Jan 10, 2020
589decc
tests
tommylees112 Jan 11, 2020
0c1378a
tests
tommylees112 Jan 11, 2020
065a9d1
tests
tommylees112 Jan 11, 2020
27997b8
tests
tommylees112 Jan 11, 2020
6606432
tests
tommylees112 Jan 11, 2020
c28464d
tests
tommylees112 Jan 11, 2020
b8bab79
tests
tommylees112 Jan 11, 2020
a80b212
tests
tommylees112 Jan 11, 2020
d17f428
tests
tommylees112 Jan 11, 2020
df5bfad
tests
tommylees112 Jan 11, 2020
320dd27
tests
tommylees112 Jan 11, 2020
b632634
tests
tommylees112 Jan 11, 2020
6661b42
tests
tommylees112 Jan 11, 2020
7a0930c
tests
tommylees112 Jan 11, 2020
e5b470e
tests
tommylees112 Jan 11, 2020
b746254
tests
tommylees112 Jan 11, 2020
c7ee395
tests
tommylees112 Jan 11, 2020
6e0c039
tests
tommylees112 Jan 11, 2020
636774a
tests
tommylees112 Jan 11, 2020
928a9fe
tests
tommylees112 Jan 11, 2020
e523326
tests
tommylees112 Jan 11, 2020
332adb3
tests
tommylees112 Jan 11, 2020
d604d4e
tests
tommylees112 Jan 11, 2020
3678701
fixing black errors
tommylees112 Jan 11, 2020
ed35cc5
rename experiment features dir
tommylees112 Jan 11, 2020
00c8117
rename experiment features dir
tommylees112 Jan 11, 2020
cf86da0
rename experiment features dir
tommylees112 Jan 11, 2020
fe097e1
rename experiment features dir
tommylees112 Jan 11, 2020
055a92e
rename experiment features dir
tommylees112 Jan 11, 2020
969402b
add model run
tommylees112 Jan 11, 2020
ca177be
add model run
tommylees112 Jan 11, 2020
b911489
add model run
tommylees112 Jan 11, 2020
257cc0b
add model run
tommylees112 Jan 11, 2020
61af241
add model run
tommylees112 Jan 11, 2020
85434b0
add model run
tommylees112 Jan 11, 2020
26bea1f
add model run
tommylees112 Jan 11, 2020
2ae00f5
add model run
tommylees112 Jan 11, 2020
07acd5e
get all experiments working
tommylees112 Jan 11, 2020
81ad806
get all experiments working
tommylees112 Jan 11, 2020
48e49ea
black
tommylees112 Jan 11, 2020
a55ebe1
update train_val_mask to prevent ALL being True / False
tommylees112 Jan 12, 2020
7ef39bf
fix utils to include a get_results function
tommylees112 Jan 12, 2020
69d6267
add print status for the _stratify_xy function
tommylees112 Jan 12, 2020
5a3c21b
minimum year can't be in test years
tommylees112 Jan 12, 2020
43a500e
clean up get_results
tommylees112 Jan 12, 2020
107250c
add models_experiment directory to admin regions
tommylees112 Jan 12, 2020
9985ec1
black
tommylees112 Jan 12, 2020
fdc4077
test to predict with NON VCI components
tommylees112 Jan 12, 2020
39da554
black preprocessors
tommylees112 Jan 12, 2020
0d18c78
update get_results function
tommylees112 Jan 12, 2020
2070f96
fix get_results
tommylees112 Jan 12, 2020
9909cba
dont overwrite print you mug
tommylees112 Jan 12, 2020
caf0512
update utils function
tommylees112 Jan 12, 2020
80a4eb6
update experiment scripts
tommylees112 Jan 12, 2020
8c313b9
update nowcast expt
tommylees112 Jan 12, 2020
ca532c1
fix nowcast
tommylees112 Jan 12, 2020
7e84479
mypy and notebooks
tommylees112 Jan 12, 2020
26038e4
test nowcast expt
tommylees112 Jan 13, 2020
3dd756f
clean 01 expt
tommylees112 Jan 13, 2020
0795524
update data file
tommylees112 Jan 13, 2020
cd80b46
update data
tommylees112 Jan 13, 2020
3a15c70
test nowcast
tommylees112 Jan 13, 2020
e7d2a6d
remove assert False statements
tommylees112 Jan 13, 2020
98f0620
update notebook
tommylees112 Jan 13, 2020
840f3f2
try to calculate aggregations only with x data
tommylees112 Jan 13, 2020
546b64f
update experiment
tommylees112 Jan 13, 2020
ffce6cf
fix import
tommylees112 Jan 13, 2020
a708e0c
update nowcast engineer
tommylees112 Jan 13, 2020
242d3b7
run engineer
tommylees112 Jan 13, 2020
277228d
run engineer
tommylees112 Jan 13, 2020
0e30cd2
stop removing all values
tommylees112 Jan 13, 2020
38d36d3
remove vscode from git
tommylees112 Jan 13, 2020
4a8af9b
nowcast changes (sorry Gabi)
tommylees112 Jan 13, 2020
5604762
try to get nowcast working
tommylees112 Jan 13, 2020
4ddc03b
try to get nowcast working
tommylees112 Jan 13, 2020
2aecd5b
try to get nowcast working
tommylees112 Jan 13, 2020
4bebbb8
try to get nowcast working
tommylees112 Jan 13, 2020
dcb9949
try to get nowcast working with engineering
tommylees112 Jan 13, 2020
37a2c84
prettier printing in base_nmodels
tommylees112 Jan 13, 2020
0d3ca28
prettier printing in base_nmodels
tommylees112 Jan 13, 2020
c560e06
nowcast update
tommylees112 Jan 13, 2020
a562df0
run engineer
tommylees112 Jan 13, 2020
166f649
add flexibility to ignore_vars
tommylees112 Jan 13, 2020
0e1cebf
fix ignore_vars
tommylees112 Jan 13, 2020
65cb37d
new notebook
tommylees112 Jan 13, 2020
218365c
test one epoch w/bigger learning rate
tommylees112 Jan 13, 2020
6b4610b
update nowcast script
tommylees112 Jan 13, 2020
e367eb8
black and fix scripts
tommylees112 Jan 13, 2020
e216bab
black and fix scripts
tommylees112 Jan 13, 2020
a240ecf
models/data
tommylees112 Jan 13, 2020
ca50aa3
models/data
tommylees112 Jan 13, 2020
0d964af
models/data
tommylees112 Jan 13, 2020
2222429
comment changes
tommylees112 Jan 13, 2020
e4364e8
notebook
tommylees112 Jan 13, 2020
d0cd9cd
fix the data.py again
tommylees112 Jan 14, 2020
49e275e
update comment
tommylees112 Jan 14, 2020
e373821
update nonvci predictors expt
tommylees112 Jan 14, 2020
cb822a8
update non vci predictors
tommylees112 Jan 14, 2020
e815236
export era5 data
tommylees112 Jan 15, 2020
6122eb6
update experiment to export hourly data
tommylees112 Jan 15, 2020
1064e10
update era5 hourly download
tommylees112 Jan 15, 2020
519c843
update era5 hourly download
tommylees112 Jan 15, 2020
08c8a62
accidentally deleted 2m temperature sorry
tommylees112 Jan 16, 2020
e6172b5
black code
tommylees112 Jan 16, 2020
d727552
black code
tommylees112 Jan 16, 2020
4cad614
Merge branch 'master' of https://github.com/esowc/ml_drought into exp…
tommylees112 Jan 16, 2020
d165ea1
blackify code
tommylees112 Jan 16, 2020
37ba203
fix mypy
tommylees112 Jan 16, 2020
edc5419
Delete settings.json
tommylees112 Jan 29, 2020
d866c26
Merge branch 'master' of https://github.com/esowc/ml_drought into exp…
tommylees112 Aug 11, 2020
2b4ef54
update admin region analysis
tommylees112 Aug 11, 2020
d43fdb7
Merge branch 'experiment/nowcast' of https://github.com/esowc/ml_drou…
tommylees112 Aug 11, 2020
e9faf7e
Merge branch 'master' of https://github.com/esowc/ml_drought into exp…
tommylees112 Aug 18, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
276 changes: 73 additions & 203 deletions notebooks/draft/28_best_performing_model.ipynb

Large diffs are not rendered by default.

2,105 changes: 2,105 additions & 0 deletions notebooks/draft/29_tl_predict_delta.ipynb

Large diffs are not rendered by default.

10,011 changes: 10,011 additions & 0 deletions notebooks/draft/30_tl_feature_exploration.ipynb

Large diffs are not rendered by default.

395 changes: 395 additions & 0 deletions notebooks/draft/31_tl_vci_nowcast_experiment.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,395 @@
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Nowcast Experiment (NO VCI in X DATA)"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"/Users/tommylees/github/ml_drought\n"
]
}
],
"source": [
"from pathlib import Path\n",
"import os\n",
"import warnings\n",
"\n",
"%load_ext autoreload\n",
"%autoreload\n",
"\n",
"# ignore warnings for now ...\n",
"warnings.filterwarnings('ignore')\n",
"\n",
"if Path('.').absolute().parents[1].name == 'ml_drought':\n",
" os.chdir(Path('.').absolute().parents[1])\n",
"\n",
"!pwd"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [],
"source": [
"import xarray as xr\n",
"import pandas as pd\n",
"import numpy as np\n",
"import matplotlib.pyplot as plt\n",
"import pickle\n",
"\n",
"data_dir = Path('data/')\n",
"# data_dir = Path('/Volumes/Lees_Extend/data/zip_data')\n",
"data_dir = Path('/Volumes/Lees_Extend/data/ecmwf_sowc/data/')\n",
"\n",
"assert data_dir.exists()"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [],
"source": [
"import seaborn as sns\n",
"from src.utils import drop_nans_and_flatten\n",
"\n",
"from src.analysis import read_train_data, read_test_data, read_pred_data"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Read in the data"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {},
"outputs": [],
"source": [
"X_train, y_train = read_train_data(data_dir)\n",
"X_test, y_test = read_test_data(data_dir)"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {},
"outputs": [],
"source": [
"ds = xr.merge([y_train, y_test]).sortby('time').sortby('lat')\n",
"d_ = xr.merge([X_train, X_test]).sortby('time').sortby('lat')\n",
"ds = xr.merge([ds, d_])"
]
},
{
"cell_type": "code",
"execution_count": 7,
"metadata": {},
"outputs": [],
"source": [
"from src.utils import get_ds_mask\n",
"mask = get_ds_mask(X_train.VCI)"
]
},
{
"cell_type": "code",
"execution_count": 8,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"['ealstm', 'linear_network', 'linear_regression', 'previous_month', 'rnn']"
],
"text/plain": [
"['ealstm', 'linear_network', 'linear_regression', 'previous_month', 'rnn']"
]
},
"execution_count": 8,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"[d.name for d in (data_dir / 'models' / '2020_01_13:151544_nowcast_tommy').iterdir()]"
]
},
{
"cell_type": "code",
"execution_count": 48,
"metadata": {},
"outputs": [],
"source": [
"# Standard Experiments\n",
"bline_pred = read_pred_data('previous_month', data_dir)[-1].where(~mask)\n",
"orig_ln_pred = read_pred_data('linear_network', data_dir,)[-1].where(~mask)\n",
"orig_rnn_pred = read_pred_data('rnn', data_dir,)[-1].where(~mask)\n",
"orig_ealstm_pred = read_pred_data('ealstm', data_dir)[-1].where(~mask)\n",
"\n",
"# Predict Delta Experiments \n",
"ln_pred = read_pred_data('linear_network', data_dir, experiment='one_month_forecast_predict_delta')[-1].where(~mask)\n",
"ealstm_pred = read_pred_data('ealstm', data_dir, experiment='one_month_forecast_predict_delta')[-1].where(~mask)\n",
"\n",
"# ealstm_pred = read_pred_data('ealstm', data_dir)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Explore how perform in each month"
]
},
{
"cell_type": "code",
"execution_count": 13,
"metadata": {},
"outputs": [],
"source": [
"from src.analysis import annual_scores"
]
},
{
"cell_type": "code",
"execution_count": 23,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"True\n"
]
},
{
"data": {
"text/html": [
"[]"
],
"text/plain": [
"[]"
]
},
"execution_count": 23,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"print((data_dir / 'models/one_month_forecast_predict_delta/rnn/').exists())\n",
"[d.name for d in (data_dir / 'models/one_month_forecast_predict_delta/rnn/').iterdir()]"
]
},
{
"cell_type": "code",
"execution_count": 46,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>ealstm</th>\n",
" <th>linear_network</th>\n",
" <th>month</th>\n",
" <th>year</th>\n",
" <th>metric</th>\n",
" <th>time</th>\n",
" <th>previous_month</th>\n",
" <th>orig_linear_network</th>\n",
" <th>orig_ealstm</th>\n",
" <th>orig_rnn</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>0</th>\n",
" <td>9.518235</td>\n",
" <td>20.316086</td>\n",
" <td>1.0</td>\n",
" <td>2011.0</td>\n",
" <td>rmse</td>\n",
" <td>2011-01-01</td>\n",
" <td>9.79577</td>\n",
" <td>22.490418</td>\n",
" <td>13.402106</td>\n",
" <td>11.853916</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1</th>\n",
" <td>9.518235</td>\n",
" <td>20.316086</td>\n",
" <td>1.0</td>\n",
" <td>2011.0</td>\n",
" <td>rmse</td>\n",
" <td>2011-01-01</td>\n",
" <td>9.79577</td>\n",
" <td>-0.354995</td>\n",
" <td>0.518841</td>\n",
" <td>0.623585</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2</th>\n",
" <td>9.518235</td>\n",
" <td>20.316086</td>\n",
" <td>1.0</td>\n",
" <td>2011.0</td>\n",
" <td>rmse</td>\n",
" <td>2011-01-01</td>\n",
" <td>9.79577</td>\n",
" <td>22.490418</td>\n",
" <td>13.402106</td>\n",
" <td>11.853916</td>\n",
" </tr>\n",
" <tr>\n",
" <th>3</th>\n",
" <td>9.518235</td>\n",
" <td>20.316086</td>\n",
" <td>1.0</td>\n",
" <td>2011.0</td>\n",
" <td>rmse</td>\n",
" <td>2011-01-01</td>\n",
" <td>9.79577</td>\n",
" <td>-0.354995</td>\n",
" <td>0.518841</td>\n",
" <td>0.623585</td>\n",
" </tr>\n",
" <tr>\n",
" <th>4</th>\n",
" <td>9.518235</td>\n",
" <td>20.316086</td>\n",
" <td>1.0</td>\n",
" <td>2011.0</td>\n",
" <td>rmse</td>\n",
" <td>2011-01-01</td>\n",
" <td>9.79577</td>\n",
" <td>22.490418</td>\n",
" <td>13.402106</td>\n",
" <td>11.853916</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" ealstm linear_network month year metric time previous_month \\\n",
"0 9.518235 20.316086 1.0 2011.0 rmse 2011-01-01 9.79577 \n",
"1 9.518235 20.316086 1.0 2011.0 rmse 2011-01-01 9.79577 \n",
"2 9.518235 20.316086 1.0 2011.0 rmse 2011-01-01 9.79577 \n",
"3 9.518235 20.316086 1.0 2011.0 rmse 2011-01-01 9.79577 \n",
"4 9.518235 20.316086 1.0 2011.0 rmse 2011-01-01 9.79577 \n",
"\n",
" orig_linear_network orig_ealstm orig_rnn \n",
"0 22.490418 13.402106 11.853916 \n",
"1 -0.354995 0.518841 0.623585 \n",
"2 22.490418 13.402106 11.853916 \n",
"3 -0.354995 0.518841 0.623585 \n",
"4 22.490418 13.402106 11.853916 "
]
},
"execution_count": 46,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# load the monthly scores dictionary\n",
"experiment = 'one_month_forecast_predict_delta'\n",
"monthly_scores = annual_scores(\n",
" data_path=data_dir,\n",
" models=['linear_network', 'ealstm'],\n",
" metrics=['rmse', 'r2'],\n",
" pred_years=[y for y in range(2011, 2019)],\n",
" experiment=experiment,\n",
" true_data_experiment='one_month_forecast',\n",
" target_var='VCI',\n",
" verbose=False,\n",
" to_dataframe=True\n",
")\n",
"monthly_scores['time'] = monthly_scores.apply(lambda row: pd.to_datetime(f\"{int(row.month)}-{int(row.year)}\"), axis=1)\n",
"\n",
"monthly_scores2 = annual_scores(\n",
" data_path=data_dir,\n",
" models=['linear_network', 'ealstm', 'rnn', 'previous_month'],\n",
" metrics=['rmse', 'r2'],\n",
" pred_years=[y for y in range(2011, 2019)],\n",
" experiment='one_month_forecast',\n",
" true_data_experiment='one_month_forecast',\n",
" target_var='VCI',\n",
" verbose=False,\n",
" to_dataframe=True\n",
")\n",
"monthly_scores2['time'] = monthly_scores.apply(lambda row: pd.to_datetime(f\"{int(row.month)}-{int(row.year)}\"), axis=1)\n",
"\n",
"# rename columns and to merge dataframes\n",
"monthly_scores2 = monthly_scores2.join(\n",
" monthly_scores2[['linear_network', 'ealstm', 'rnn']].add_prefix('orig_')\n",
").drop(columns=['linear_network', 'ealstm', 'rnn'])\n",
"\n",
"# merge\n",
"monthly_scores = pd.merge(monthly_scores, monthly_scores2)\n",
"monthly_scores.head()"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.0"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
Loading