-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
93 lines (72 loc) · 2.62 KB
/
Copy pathMakefile
File metadata and controls
93 lines (72 loc) · 2.62 KB
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
# =========================================================================
# soft-commodities-forecast-benchmark — Makefile
# =========================================================================
# Standard reproducibility entry points. Run `make help` for an overview.
PYTHON ?= python
PIP ?= pip
ASSETS := cocoa coffee sugar cotton
.PHONY: help install dev-install fetch train predict evaluate \
reproduce reproduce-cocoa reproduce-coffee reproduce-sugar reproduce-cotton \
test lint format clean
help:
@echo "soft-commodities-forecast-benchmark"
@echo ""
@echo "Setup:"
@echo " make install install runtime dependencies"
@echo " make dev-install install runtime + development dependencies"
@echo ""
@echo "Reproduction:"
@echo " make reproduce run the full benchmark for all four commodities"
@echo " and assert results match the stored diagnostics"
@echo " make reproduce-cocoa run only one asset (also: -coffee, -sugar, -cotton)"
@echo ""
@echo "Pipeline (per asset):"
@echo " make train ASSET=cocoa fit the GJR-GARCH-t model"
@echo " make predict ASSET=cocoa walk-forward forecast"
@echo " make evaluate ASSET=cocoa VaR backtests + diagnostics JSON"
@echo ""
@echo "Quality:"
@echo " make test run pytest"
@echo " make lint ruff check"
@echo " make format black + ruff format"
@echo " make clean remove build artefacts and caches"
install:
$(PIP) install -e .
dev-install:
$(PIP) install -e ".[dev]"
ASSET ?= cocoa
train:
$(PYTHON) -m benchmark.train --asset $(ASSET)
predict:
$(PYTHON) -m benchmark.predict --asset $(ASSET)
evaluate:
$(PYTHON) -m benchmark.evaluate --asset $(ASSET)
hmm:
$(PYTHON) -m benchmark.hmm_regime --asset $(ASSET)
hmm-evaluate:
$(PYTHON) -m benchmark.hmm_evaluate
hmm-all:
for a in $(ASSETS); do $(PYTHON) -m benchmark.hmm_regime --asset $$a; done
$(PYTHON) -m benchmark.hmm_evaluate
reproduce: reproduce-cocoa reproduce-coffee reproduce-sugar reproduce-cotton
@echo ""
@echo "All four commodities reproduced successfully."
reproduce-cocoa:
$(PYTHON) -m benchmark.reproduce --asset cocoa
reproduce-coffee:
$(PYTHON) -m benchmark.reproduce --asset coffee
reproduce-sugar:
$(PYTHON) -m benchmark.reproduce --asset sugar
reproduce-cotton:
$(PYTHON) -m benchmark.reproduce --asset cotton
test:
pytest -q
lint:
ruff check src tests
format:
black src tests
ruff format src tests
clean:
rm -rf build dist *.egg-info .pytest_cache .ruff_cache .mypy_cache
find . -type d -name "__pycache__" -exec rm -rf {} +
find . -type d -name ".ipynb_checkpoints" -exec rm -rf {} +