File size: 1,754 Bytes
e471495
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
import marimo

__generated_with = "0.14.17"
app = marimo.App(width="medium")


@app.cell
def _():
    import os
    import subprocess
    import sys
    from pathlib import Path
    import marimo as mo
    return Path, mo, os, subprocess, sys


@app.cell
def _(Path, os):
    ROOT = Path(__file__).resolve().parent
    SCRIPT = ROOT / "scripts" / "decode_reimplementation.py"
    OUTPUT = ROOT / "decode_reimplementation_outputs"
    TRAIN_ENV = os.environ.copy()
    TRAIN_ENV["DECODE_DISABLE_TENSORFLOW"] = "1"
    return OUTPUT, SCRIPT, TRAIN_ENV


@app.cell
def _(mo):
    mode = mo.ui.dropdown(["paper_buildings", "meters"], value="paper_buildings", label="Scope")
    model_case = mo.ui.dropdown(["baselines", "lstm", "cnn", "tcn", "timesnet"], value="baselines", label="Model case")
    run = mo.ui.run_button(label="Train full dataset")
    mo.vstack([mo.md("# DECODE full-data experiments"), mode, model_case, run])
    return mode, model_case, run


@app.cell
def _(SCRIPT, TRAIN_ENV, mode, model_case, run, subprocess, sys):
    if run.value:
        args = [sys.executable, str(SCRIPT), "--mode", mode.value]
        if model_case.value == "baselines":
            args += ["--skip-lstm"]
        else:
            args += ["--dl-models", model_case.value, "--epochs", "20", "--batch-size", "64"]
            if model_case.value == "timesnet":
                args += ["--lookback", "144"]
        completed = subprocess.run(args, check=True, env=TRAIN_ENV, text=True)
    else:
        completed = None
    completed
    return


@app.cell
def _(OUTPUT, mo):
    result_files = sorted(OUTPUT.glob("results_*.csv"))
    mo.md("## Outputs\n" + "\n".join(f"- `{p}`" for p in result_files))
    return


if __name__ == "__main__":
    app.run()