HoangTrungNguyen commited on
Commit
e471495
·
verified ·
1 Parent(s): b5f2bcf

Global scaling, normalized MAE, saved models and marimo workflow

Browse files
Files changed (1) hide show
  1. DECODE_marimo.py +61 -0
DECODE_marimo.py ADDED
@@ -0,0 +1,61 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import marimo
2
+
3
+ __generated_with = "0.14.17"
4
+ app = marimo.App(width="medium")
5
+
6
+
7
+ @app.cell
8
+ def _():
9
+ import os
10
+ import subprocess
11
+ import sys
12
+ from pathlib import Path
13
+ import marimo as mo
14
+ return Path, mo, os, subprocess, sys
15
+
16
+
17
+ @app.cell
18
+ def _(Path, os):
19
+ ROOT = Path(__file__).resolve().parent
20
+ SCRIPT = ROOT / "scripts" / "decode_reimplementation.py"
21
+ OUTPUT = ROOT / "decode_reimplementation_outputs"
22
+ TRAIN_ENV = os.environ.copy()
23
+ TRAIN_ENV["DECODE_DISABLE_TENSORFLOW"] = "1"
24
+ return OUTPUT, SCRIPT, TRAIN_ENV
25
+
26
+
27
+ @app.cell
28
+ def _(mo):
29
+ mode = mo.ui.dropdown(["paper_buildings", "meters"], value="paper_buildings", label="Scope")
30
+ model_case = mo.ui.dropdown(["baselines", "lstm", "cnn", "tcn", "timesnet"], value="baselines", label="Model case")
31
+ run = mo.ui.run_button(label="Train full dataset")
32
+ mo.vstack([mo.md("# DECODE full-data experiments"), mode, model_case, run])
33
+ return mode, model_case, run
34
+
35
+
36
+ @app.cell
37
+ def _(SCRIPT, TRAIN_ENV, mode, model_case, run, subprocess, sys):
38
+ if run.value:
39
+ args = [sys.executable, str(SCRIPT), "--mode", mode.value]
40
+ if model_case.value == "baselines":
41
+ args += ["--skip-lstm"]
42
+ else:
43
+ args += ["--dl-models", model_case.value, "--epochs", "20", "--batch-size", "64"]
44
+ if model_case.value == "timesnet":
45
+ args += ["--lookback", "144"]
46
+ completed = subprocess.run(args, check=True, env=TRAIN_ENV, text=True)
47
+ else:
48
+ completed = None
49
+ completed
50
+ return
51
+
52
+
53
+ @app.cell
54
+ def _(OUTPUT, mo):
55
+ result_files = sorted(OUTPUT.glob("results_*.csv"))
56
+ mo.md("## Outputs\n" + "\n".join(f"- `{p}`" for p in result_files))
57
+ return
58
+
59
+
60
+ if __name__ == "__main__":
61
+ app.run()