forecast-evaluation 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- forecast_evaluation-0.1.0/LICENSE +21 -0
- forecast_evaluation-0.1.0/PKG-INFO +111 -0
- forecast_evaluation-0.1.0/README.md +75 -0
- forecast_evaluation-0.1.0/pyproject.toml +101 -0
- forecast_evaluation-0.1.0/setup.cfg +4 -0
- forecast_evaluation-0.1.0/src/forecast_evaluation/__init__.py +91 -0
- forecast_evaluation-0.1.0/src/forecast_evaluation/core/__init__.py +14 -0
- forecast_evaluation-0.1.0/src/forecast_evaluation/core/ar_p_model.py +598 -0
- forecast_evaluation-0.1.0/src/forecast_evaluation/core/main_table.py +138 -0
- forecast_evaluation-0.1.0/src/forecast_evaluation/core/outturns_revisions_table.py +53 -0
- forecast_evaluation-0.1.0/src/forecast_evaluation/core/random_walk_model.py +210 -0
- forecast_evaluation-0.1.0/src/forecast_evaluation/core/revisions_table.py +82 -0
- forecast_evaluation-0.1.0/src/forecast_evaluation/core/transformations.py +277 -0
- forecast_evaluation-0.1.0/src/forecast_evaluation/dashboard/__init__.py +0 -0
- forecast_evaluation-0.1.0/src/forecast_evaluation/dashboard/app.py +7 -0
- forecast_evaluation-0.1.0/src/forecast_evaluation/dashboard/create_app.py +101 -0
- forecast_evaluation-0.1.0/src/forecast_evaluation/dashboard/tabs/about.py +20 -0
- forecast_evaluation-0.1.0/src/forecast_evaluation/dashboard/tabs/accuracy.py +522 -0
- forecast_evaluation-0.1.0/src/forecast_evaluation/dashboard/tabs/bias.py +331 -0
- forecast_evaluation-0.1.0/src/forecast_evaluation/dashboard/tabs/efficiency.py +218 -0
- forecast_evaluation-0.1.0/src/forecast_evaluation/dashboard/tabs/hedgehog.py +66 -0
- forecast_evaluation-0.1.0/src/forecast_evaluation/dashboard/tabs/outturn_revisions.py +144 -0
- forecast_evaluation-0.1.0/src/forecast_evaluation/dashboard/tabs/quantile_time_machine.py +85 -0
- forecast_evaluation-0.1.0/src/forecast_evaluation/dashboard/tabs/time_machine.py +83 -0
- forecast_evaluation-0.1.0/src/forecast_evaluation/dashboard/theme/_brand.yml +21 -0
- forecast_evaluation-0.1.0/src/forecast_evaluation/dashboard/theme/brand.py +13 -0
- forecast_evaluation-0.1.0/src/forecast_evaluation/dashboard/ui.py +643 -0
- forecast_evaluation-0.1.0/src/forecast_evaluation/dashboard/utils.py +138 -0
- forecast_evaluation-0.1.0/src/forecast_evaluation/data/DensityForecastData.py +613 -0
- forecast_evaluation-0.1.0/src/forecast_evaluation/data/ForecastData.py +649 -0
- forecast_evaluation-0.1.0/src/forecast_evaluation/data/__init__.py +6 -0
- forecast_evaluation-0.1.0/src/forecast_evaluation/data/files/fer_forecasts.parquet +0 -0
- forecast_evaluation-0.1.0/src/forecast_evaluation/data/files/fer_outturns.parquet +0 -0
- forecast_evaluation-0.1.0/src/forecast_evaluation/data/loader.py +25 -0
- forecast_evaluation-0.1.0/src/forecast_evaluation/data/sample_data.py +124 -0
- forecast_evaluation-0.1.0/src/forecast_evaluation/data/schema.py +74 -0
- forecast_evaluation-0.1.0/src/forecast_evaluation/data/utils.py +211 -0
- forecast_evaluation-0.1.0/src/forecast_evaluation/tests/__init__.py +29 -0
- forecast_evaluation-0.1.0/src/forecast_evaluation/tests/accuracy.py +305 -0
- forecast_evaluation-0.1.0/src/forecast_evaluation/tests/bias.py +280 -0
- forecast_evaluation-0.1.0/src/forecast_evaluation/tests/blanchard_leigh.py +301 -0
- forecast_evaluation-0.1.0/src/forecast_evaluation/tests/diebold_mariano.py +269 -0
- forecast_evaluation-0.1.0/src/forecast_evaluation/tests/fluctuation_tests.py +213 -0
- forecast_evaluation-0.1.0/src/forecast_evaluation/tests/results.py +556 -0
- forecast_evaluation-0.1.0/src/forecast_evaluation/tests/revisions_errors_correlation.py +238 -0
- forecast_evaluation-0.1.0/src/forecast_evaluation/tests/revisions_predictability.py +239 -0
- forecast_evaluation-0.1.0/src/forecast_evaluation/tests/rolling_analysis.py +145 -0
- forecast_evaluation-0.1.0/src/forecast_evaluation/tests/strong_efficiency.py +267 -0
- forecast_evaluation-0.1.0/src/forecast_evaluation/tests/weak_efficiency.py +312 -0
- forecast_evaluation-0.1.0/src/forecast_evaluation/utils.py +247 -0
- forecast_evaluation-0.1.0/src/forecast_evaluation/visualisations/__init__.py +33 -0
- forecast_evaluation-0.1.0/src/forecast_evaluation/visualisations/accuracy.py +419 -0
- forecast_evaluation-0.1.0/src/forecast_evaluation/visualisations/bias.py +286 -0
- forecast_evaluation-0.1.0/src/forecast_evaluation/visualisations/blanchard_leigh.py +89 -0
- forecast_evaluation-0.1.0/src/forecast_evaluation/visualisations/density_plots.py +177 -0
- forecast_evaluation-0.1.0/src/forecast_evaluation/visualisations/errors.py +222 -0
- forecast_evaluation-0.1.0/src/forecast_evaluation/visualisations/forecast.py +121 -0
- forecast_evaluation-0.1.0/src/forecast_evaluation/visualisations/forecast_errors.py +394 -0
- forecast_evaluation-0.1.0/src/forecast_evaluation/visualisations/hedgehog.py +157 -0
- forecast_evaluation-0.1.0/src/forecast_evaluation/visualisations/outturn_revisions.py +269 -0
- forecast_evaluation-0.1.0/src/forecast_evaluation/visualisations/revisions_predictability.py +74 -0
- forecast_evaluation-0.1.0/src/forecast_evaluation/visualisations/strong_efficiency.py +92 -0
- forecast_evaluation-0.1.0/src/forecast_evaluation/visualisations/theme.py +80 -0
- forecast_evaluation-0.1.0/src/forecast_evaluation.egg-info/PKG-INFO +111 -0
- forecast_evaluation-0.1.0/src/forecast_evaluation.egg-info/SOURCES.txt +73 -0
- forecast_evaluation-0.1.0/src/forecast_evaluation.egg-info/dependency_links.txt +1 -0
- forecast_evaluation-0.1.0/src/forecast_evaluation.egg-info/requires.txt +18 -0
- forecast_evaluation-0.1.0/src/forecast_evaluation.egg-info/top_level.txt +1 -0
- forecast_evaluation-0.1.0/tests/test_DM_test.py +204 -0
- forecast_evaluation-0.1.0/tests/test_accuracy.py +453 -0
- forecast_evaluation-0.1.0/tests/test_bias.py +642 -0
- forecast_evaluation-0.1.0/tests/test_dashboard.py +38 -0
- forecast_evaluation-0.1.0/tests/test_data_class.py +629 -0
- forecast_evaluation-0.1.0/tests/test_density_data_class.py +412 -0
- forecast_evaluation-0.1.0/tests/test_result_classes.py +299 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Bank of England
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: forecast_evaluation
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: A package for Forecast Evaluation
|
|
5
|
+
Author-email: James Hurley <James.Hurley@bankofengland.co.uk>, Paul Labonne <Paul.Labonne@bankofengland.co.uk>, Harry Li <Harry.Li@bankofengland.co.uk>
|
|
6
|
+
Maintainer-email: James Hurley <James.Hurley@bankofengland.co.uk>, Paul Labonne <Paul.Labonne@bankofengland.co.uk>, Harry Li <Harry.Li@bankofengland.co.uk>
|
|
7
|
+
License-Expression: MIT
|
|
8
|
+
Project-URL: Homepage, https://github.com/bank-of-england/forecast_evaluation
|
|
9
|
+
Project-URL: Issues, https://github.com/bank-of-england/forecast_evaluation/issues
|
|
10
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
11
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
14
|
+
Classifier: Operating System :: OS Independent
|
|
15
|
+
Requires-Python: >=3.10
|
|
16
|
+
Description-Content-Type: text/markdown
|
|
17
|
+
License-File: LICENSE
|
|
18
|
+
Requires-Dist: pyarrow>=14.0.0
|
|
19
|
+
Requires-Dist: pandas>=1.5.3
|
|
20
|
+
Requires-Dist: tqdm>=4.65.0
|
|
21
|
+
Requires-Dist: matplotlib>=3.7.0
|
|
22
|
+
Requires-Dist: pandera>=0.24.0
|
|
23
|
+
Requires-Dist: numpy>=1.24.0
|
|
24
|
+
Requires-Dist: shiny[theme]>=0.6.0
|
|
25
|
+
Requires-Dist: statsmodels>=0.14.0
|
|
26
|
+
Requires-Dist: scipy>=1.10.0
|
|
27
|
+
Requires-Dist: linearmodels>=6.0
|
|
28
|
+
Provides-Extra: dev
|
|
29
|
+
Requires-Dist: pre_commit>=4.3.0; extra == "dev"
|
|
30
|
+
Requires-Dist: pytest>=8.4.1; extra == "dev"
|
|
31
|
+
Requires-Dist: ruff>=0.13.1; extra == "dev"
|
|
32
|
+
Requires-Dist: Sphinx>=8.2.3; extra == "dev"
|
|
33
|
+
Requires-Dist: sphinx-book-theme>=1.1.4; extra == "dev"
|
|
34
|
+
Requires-Dist: IPython>=9.4.0; extra == "dev"
|
|
35
|
+
Dynamic: license-file
|
|
36
|
+
|
|
37
|
+
# Forecast Evaluation Package
|
|
38
|
+
|
|
39
|
+
A Python package for analysing and visualising economic forecast data.
|
|
40
|
+
|
|
41
|
+
### Features
|
|
42
|
+
The package contains tools to inspect the accuracy, unbiasedness and efficiency of economic forecasts. It includes visualisation tools, statistical tests and accuracy metrics commonly used in forecast evaluation literature. In handles both point forecasts (with the `ForecastData` object) and density forecasts (with the `DensityForecastData` object).
|
|
43
|
+
|
|
44
|
+
#### Visualisation for forecasts, outturns and errors:
|
|
45
|
+
* Forecast vintages plot
|
|
46
|
+
* Accuracy and bias plots (average and rolling averages)
|
|
47
|
+
* Hedgehog plots
|
|
48
|
+
* Outturn revisions
|
|
49
|
+
* Forecast error distributions
|
|
50
|
+
|
|
51
|
+
#### Statistical tests
|
|
52
|
+
* Accuracy analysis (Diebold-Mariano test)
|
|
53
|
+
* Bias analysis (Mincer-Zarnowitz Regression)
|
|
54
|
+
* Weak Efficiency analysis (Revision predictability)
|
|
55
|
+
* Strong Efficiency analysis (Blanchard-Leigh regression)
|
|
56
|
+
* Testing correlation between forecast revisions and forecast errors
|
|
57
|
+
* Rolling-window analysis of most tests with fluctuation tests.
|
|
58
|
+
|
|
59
|
+
#### Accuracy metrics available
|
|
60
|
+
* Root mean square error
|
|
61
|
+
* Mean absolute error
|
|
62
|
+
* Median absolute error
|
|
63
|
+
|
|
64
|
+
All of the above features can be explored interactively in a dashboard.
|
|
65
|
+
|
|
66
|
+
## Installation
|
|
67
|
+
|
|
68
|
+
#### Using pip
|
|
69
|
+
```bash
|
|
70
|
+
# install from PyPI
|
|
71
|
+
pip install forecast_evaluation
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
### Loading data
|
|
75
|
+
|
|
76
|
+
#### Data format
|
|
77
|
+
The forecasts should be in a `pandas` dataframe format with the following structure:
|
|
78
|
+
```
|
|
79
|
+
date vintage_date variable source frequency forecast_horizon value
|
|
80
|
+
0 2014-12-31 2015-03-31 gdp BVAR Q 0 100
|
|
81
|
+
1 2015-03-31 2015-03-31 gdp BVAR Q 1 101
|
|
82
|
+
2 2015-06-30 2015-03-31 gdp BVAR Q 2 102
|
|
83
|
+
3 2015-09-30 2015-03-31 gdp BVAR Q 3 103
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
Outturns follow the same structure but do not contain a `source` column.
|
|
87
|
+
|
|
88
|
+
#### Creating a ForecastData instance
|
|
89
|
+
The package's main object is the `ForecastData` class which holds the outturns, forecasts, transformed forecasts and forecast errors. You can create an instance of this class with:
|
|
90
|
+
|
|
91
|
+
```python
|
|
92
|
+
import forecast_evaluation as fe
|
|
93
|
+
|
|
94
|
+
forecast_data = fe.ForecastData(forecasts=forecasts_dataframe, outturns=outturns_dataframe)
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
The package also comes with built-in data used in the Bank of England 2026 Forecast Evaluation Report which can be loaded with:
|
|
98
|
+
```python
|
|
99
|
+
forecast_data = fe.ForecastData(load_fer=True)
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
The forecast_data object has methods to filter, analyse and visualise the data and resulting analysis. These are illustrated in the example notebook included in the repository: [notebooks/example_notebook.ipynb](https://github.com/bank-of-england/forecast_evaluation/blob/main/notebooks/example_notebook.ipynb)
|
|
103
|
+
|
|
104
|
+
Results from the Bank of England 2026 Forecast Evaluation Macro Technical Paper can also be replicated with the following notebook: [notebooks/mtp_replication_notebook.ipynb](https://github.com/bank-of-england/forecast_evaluation/blob/main/notebooks/mtp_replication_notebook.ipynb)
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
## Run the dashboard
|
|
108
|
+
To make visualisation of forecasts and their properties easier, the package includes a dashboard. Once a ForecastData object has been created the dashboard can be run with:
|
|
109
|
+
```python
|
|
110
|
+
forecast_data.run_dashboard()
|
|
111
|
+
```
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
# Forecast Evaluation Package
|
|
2
|
+
|
|
3
|
+
A Python package for analysing and visualising economic forecast data.
|
|
4
|
+
|
|
5
|
+
### Features
|
|
6
|
+
The package contains tools to inspect the accuracy, unbiasedness and efficiency of economic forecasts. It includes visualisation tools, statistical tests and accuracy metrics commonly used in forecast evaluation literature. In handles both point forecasts (with the `ForecastData` object) and density forecasts (with the `DensityForecastData` object).
|
|
7
|
+
|
|
8
|
+
#### Visualisation for forecasts, outturns and errors:
|
|
9
|
+
* Forecast vintages plot
|
|
10
|
+
* Accuracy and bias plots (average and rolling averages)
|
|
11
|
+
* Hedgehog plots
|
|
12
|
+
* Outturn revisions
|
|
13
|
+
* Forecast error distributions
|
|
14
|
+
|
|
15
|
+
#### Statistical tests
|
|
16
|
+
* Accuracy analysis (Diebold-Mariano test)
|
|
17
|
+
* Bias analysis (Mincer-Zarnowitz Regression)
|
|
18
|
+
* Weak Efficiency analysis (Revision predictability)
|
|
19
|
+
* Strong Efficiency analysis (Blanchard-Leigh regression)
|
|
20
|
+
* Testing correlation between forecast revisions and forecast errors
|
|
21
|
+
* Rolling-window analysis of most tests with fluctuation tests.
|
|
22
|
+
|
|
23
|
+
#### Accuracy metrics available
|
|
24
|
+
* Root mean square error
|
|
25
|
+
* Mean absolute error
|
|
26
|
+
* Median absolute error
|
|
27
|
+
|
|
28
|
+
All of the above features can be explored interactively in a dashboard.
|
|
29
|
+
|
|
30
|
+
## Installation
|
|
31
|
+
|
|
32
|
+
#### Using pip
|
|
33
|
+
```bash
|
|
34
|
+
# install from PyPI
|
|
35
|
+
pip install forecast_evaluation
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
### Loading data
|
|
39
|
+
|
|
40
|
+
#### Data format
|
|
41
|
+
The forecasts should be in a `pandas` dataframe format with the following structure:
|
|
42
|
+
```
|
|
43
|
+
date vintage_date variable source frequency forecast_horizon value
|
|
44
|
+
0 2014-12-31 2015-03-31 gdp BVAR Q 0 100
|
|
45
|
+
1 2015-03-31 2015-03-31 gdp BVAR Q 1 101
|
|
46
|
+
2 2015-06-30 2015-03-31 gdp BVAR Q 2 102
|
|
47
|
+
3 2015-09-30 2015-03-31 gdp BVAR Q 3 103
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
Outturns follow the same structure but do not contain a `source` column.
|
|
51
|
+
|
|
52
|
+
#### Creating a ForecastData instance
|
|
53
|
+
The package's main object is the `ForecastData` class which holds the outturns, forecasts, transformed forecasts and forecast errors. You can create an instance of this class with:
|
|
54
|
+
|
|
55
|
+
```python
|
|
56
|
+
import forecast_evaluation as fe
|
|
57
|
+
|
|
58
|
+
forecast_data = fe.ForecastData(forecasts=forecasts_dataframe, outturns=outturns_dataframe)
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
The package also comes with built-in data used in the Bank of England 2026 Forecast Evaluation Report which can be loaded with:
|
|
62
|
+
```python
|
|
63
|
+
forecast_data = fe.ForecastData(load_fer=True)
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
The forecast_data object has methods to filter, analyse and visualise the data and resulting analysis. These are illustrated in the example notebook included in the repository: [notebooks/example_notebook.ipynb](https://github.com/bank-of-england/forecast_evaluation/blob/main/notebooks/example_notebook.ipynb)
|
|
67
|
+
|
|
68
|
+
Results from the Bank of England 2026 Forecast Evaluation Macro Technical Paper can also be replicated with the following notebook: [notebooks/mtp_replication_notebook.ipynb](https://github.com/bank-of-england/forecast_evaluation/blob/main/notebooks/mtp_replication_notebook.ipynb)
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
## Run the dashboard
|
|
72
|
+
To make visualisation of forecasts and their properties easier, the package includes a dashboard. Once a ForecastData object has been created the dashboard can be run with:
|
|
73
|
+
```python
|
|
74
|
+
forecast_data.run_dashboard()
|
|
75
|
+
```
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "forecast_evaluation"
|
|
3
|
+
version = "0.1.0"
|
|
4
|
+
|
|
5
|
+
description = "A package for Forecast Evaluation"
|
|
6
|
+
authors = [
|
|
7
|
+
{name="James Hurley", email="James.Hurley@bankofengland.co.uk"},
|
|
8
|
+
{name="Paul Labonne", email="Paul.Labonne@bankofengland.co.uk"},
|
|
9
|
+
{name="Harry Li", email="Harry.Li@bankofengland.co.uk"},
|
|
10
|
+
]
|
|
11
|
+
maintainers = [
|
|
12
|
+
{name="James Hurley", email="James.Hurley@bankofengland.co.uk"},
|
|
13
|
+
{name="Paul Labonne", email="Paul.Labonne@bankofengland.co.uk"},
|
|
14
|
+
{name="Harry Li", email="Harry.Li@bankofengland.co.uk"},
|
|
15
|
+
]
|
|
16
|
+
license = "MIT"
|
|
17
|
+
readme = "README.md"
|
|
18
|
+
requires-python = ">=3.10"
|
|
19
|
+
classifiers = [
|
|
20
|
+
"Programming Language :: Python :: 3.10",
|
|
21
|
+
"Programming Language :: Python :: 3.11",
|
|
22
|
+
"Programming Language :: Python :: 3.12",
|
|
23
|
+
"Programming Language :: Python :: 3.13",
|
|
24
|
+
"Operating System :: OS Independent",
|
|
25
|
+
]
|
|
26
|
+
|
|
27
|
+
dependencies = [
|
|
28
|
+
"pyarrow>=14.0.0",
|
|
29
|
+
"pandas>=1.5.3",
|
|
30
|
+
"tqdm>=4.65.0",
|
|
31
|
+
"matplotlib>=3.7.0",
|
|
32
|
+
"pandera>=0.24.0",
|
|
33
|
+
"numpy>=1.24.0",
|
|
34
|
+
"shiny[theme]>=0.6.0",
|
|
35
|
+
"statsmodels>=0.14.0",
|
|
36
|
+
"scipy>=1.10.0",
|
|
37
|
+
"linearmodels>=6.0",
|
|
38
|
+
]
|
|
39
|
+
|
|
40
|
+
[project.optional-dependencies]
|
|
41
|
+
dev = [
|
|
42
|
+
"pre_commit>=4.3.0",
|
|
43
|
+
"pytest>=8.4.1",
|
|
44
|
+
"ruff>=0.13.1",
|
|
45
|
+
"Sphinx>=8.2.3",
|
|
46
|
+
"sphinx-book-theme>=1.1.4",
|
|
47
|
+
"IPython>=9.4.0",
|
|
48
|
+
]
|
|
49
|
+
|
|
50
|
+
[project.urls]
|
|
51
|
+
Homepage = "https://github.com/bank-of-england/forecast_evaluation"
|
|
52
|
+
Issues = "https://github.com/bank-of-england/forecast_evaluation/issues"
|
|
53
|
+
|
|
54
|
+
[build-system]
|
|
55
|
+
requires = ["setuptools"]
|
|
56
|
+
build-backend = "setuptools.build_meta"
|
|
57
|
+
|
|
58
|
+
[tool.setuptools.package-data]
|
|
59
|
+
forecast_evaluation = ["data/files/*.parquet", "dashboard/theme/*.yml", "dashboard/theme/*.png"]
|
|
60
|
+
|
|
61
|
+
[tool.setuptools]
|
|
62
|
+
include-package-data = true
|
|
63
|
+
|
|
64
|
+
[tool.ruff]
|
|
65
|
+
line-length = 120
|
|
66
|
+
target-version = "py39"
|
|
67
|
+
|
|
68
|
+
[tool.ruff.lint]
|
|
69
|
+
# Enable specific rules
|
|
70
|
+
select = [
|
|
71
|
+
"E", # pycodestyle
|
|
72
|
+
"F", # pyflakes
|
|
73
|
+
"I", # isort
|
|
74
|
+
"UP", # pyupgrade
|
|
75
|
+
]
|
|
76
|
+
|
|
77
|
+
# Ignore specific rules
|
|
78
|
+
ignore = [
|
|
79
|
+
"D100", # Missing docstring in public module
|
|
80
|
+
"D104", # Missing docstring in public package,
|
|
81
|
+
"D213",
|
|
82
|
+
"D211"
|
|
83
|
+
]
|
|
84
|
+
|
|
85
|
+
# Exclude files and directories
|
|
86
|
+
exclude = [
|
|
87
|
+
".git",
|
|
88
|
+
".ruff_cache",
|
|
89
|
+
"__pycache__",
|
|
90
|
+
"build",
|
|
91
|
+
"dist",
|
|
92
|
+
"notebooks",
|
|
93
|
+
"notebooks/**",
|
|
94
|
+
"src/forecast_evaluation/dashboard/**",
|
|
95
|
+
]
|
|
96
|
+
|
|
97
|
+
[tool.ruff.lint.per-file-ignores]
|
|
98
|
+
"__init__.py" = ["F401"] # Ignore unused imports in __init__.py files
|
|
99
|
+
|
|
100
|
+
[tool.pytest.ini_options]
|
|
101
|
+
testpaths = ["tests"]
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
# forecast_evaluation/__init__.py
|
|
2
|
+
from importlib.metadata import PackageNotFoundError, version
|
|
3
|
+
|
|
4
|
+
try:
|
|
5
|
+
__version__ = version("forecast_evaluation")
|
|
6
|
+
except PackageNotFoundError:
|
|
7
|
+
__version__ = "unknown"
|
|
8
|
+
|
|
9
|
+
from .core import add_ar_p_forecasts, add_random_walk_forecasts, create_outturn_revisions
|
|
10
|
+
from .data import DensityForecastData, ForecastData, create_sample_forecasts, create_sample_outturns
|
|
11
|
+
from .data.utils import filter_fer_variables
|
|
12
|
+
from .tests import (
|
|
13
|
+
bias_analysis,
|
|
14
|
+
blanchard_leigh_horizon_analysis,
|
|
15
|
+
compare_to_benchmark,
|
|
16
|
+
compute_accuracy_statistics,
|
|
17
|
+
create_comparison_table,
|
|
18
|
+
diebold_mariano_table,
|
|
19
|
+
fluctuation_tests,
|
|
20
|
+
revision_predictability_analysis,
|
|
21
|
+
revisions_errors_correlation_analysis,
|
|
22
|
+
rolling_analysis,
|
|
23
|
+
strong_efficiency_analysis,
|
|
24
|
+
weak_efficiency_analysis,
|
|
25
|
+
)
|
|
26
|
+
from .utils import covid_filter, reconstruct_id_cols_from_unique_id
|
|
27
|
+
from .visualisations import (
|
|
28
|
+
plot_accuracy,
|
|
29
|
+
plot_average_revision_by_period,
|
|
30
|
+
plot_bias_by_horizon,
|
|
31
|
+
plot_blanchard_leigh_ratios,
|
|
32
|
+
plot_compare_to_benchmark,
|
|
33
|
+
plot_errors_across_time,
|
|
34
|
+
plot_forecast_error_density,
|
|
35
|
+
plot_forecast_errors,
|
|
36
|
+
plot_forecast_errors_by_horizon,
|
|
37
|
+
plot_hedgehog,
|
|
38
|
+
plot_outturn_revisions,
|
|
39
|
+
plot_outturns,
|
|
40
|
+
plot_rolling_bias,
|
|
41
|
+
plot_rolling_relative_accuracy,
|
|
42
|
+
plot_strong_efficiency,
|
|
43
|
+
plot_vintage,
|
|
44
|
+
)
|
|
45
|
+
|
|
46
|
+
__all__ = [
|
|
47
|
+
# Core functions
|
|
48
|
+
"create_outturn_revisions",
|
|
49
|
+
"add_random_walk_forecasts",
|
|
50
|
+
"add_ar_p_forecasts",
|
|
51
|
+
# Data classes
|
|
52
|
+
"ForecastData",
|
|
53
|
+
"DensityForecastData",
|
|
54
|
+
# Sample data functions
|
|
55
|
+
"create_sample_forecasts",
|
|
56
|
+
"create_sample_outturns",
|
|
57
|
+
# Test/analysis functions
|
|
58
|
+
"bias_analysis",
|
|
59
|
+
"blanchard_leigh_horizon_analysis",
|
|
60
|
+
"compare_to_benchmark",
|
|
61
|
+
"compute_accuracy_statistics",
|
|
62
|
+
"create_comparison_table",
|
|
63
|
+
"diebold_mariano_table",
|
|
64
|
+
"fluctuation_tests",
|
|
65
|
+
"revisions_errors_correlation_analysis",
|
|
66
|
+
"revision_predictability_analysis",
|
|
67
|
+
"rolling_analysis",
|
|
68
|
+
"strong_efficiency_analysis",
|
|
69
|
+
"weak_efficiency_analysis",
|
|
70
|
+
# Visualisation functions
|
|
71
|
+
"plot_accuracy",
|
|
72
|
+
"plot_average_revision_by_period",
|
|
73
|
+
"plot_blanchard_leigh_ratios",
|
|
74
|
+
"plot_compare_to_benchmark",
|
|
75
|
+
"plot_strong_efficiency",
|
|
76
|
+
"plot_forecast_error_density",
|
|
77
|
+
"plot_forecast_errors",
|
|
78
|
+
"plot_forecast_errors_by_horizon",
|
|
79
|
+
"plot_hedgehog",
|
|
80
|
+
"plot_outturn_revisions",
|
|
81
|
+
"plot_outturns",
|
|
82
|
+
"plot_rolling_bias",
|
|
83
|
+
"plot_rolling_relative_accuracy",
|
|
84
|
+
"plot_bias_by_horizon",
|
|
85
|
+
"plot_vintage",
|
|
86
|
+
"plot_errors_across_time",
|
|
87
|
+
# Utility functions
|
|
88
|
+
"covid_filter",
|
|
89
|
+
"filter_fer_variables",
|
|
90
|
+
"reconstruct_id_cols_from_unique_id",
|
|
91
|
+
]
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# data/__init__.py
|
|
2
|
+
from .ar_p_model import add_ar_p_forecasts
|
|
3
|
+
from .main_table import build_main_table
|
|
4
|
+
from .outturns_revisions_table import create_outturn_revisions
|
|
5
|
+
from .random_walk_model import add_random_walk_forecasts
|
|
6
|
+
from .revisions_table import create_revision_dataframe
|
|
7
|
+
|
|
8
|
+
__all__ = [
|
|
9
|
+
"build_main_table",
|
|
10
|
+
"create_revision_dataframe",
|
|
11
|
+
"create_outturn_revisions",
|
|
12
|
+
"add_random_walk_forecasts",
|
|
13
|
+
"add_ar_p_forecasts",
|
|
14
|
+
]
|