forecast-evaluation 0.0.11__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.
Files changed (92) hide show
  1. forecast_evaluation-0.0.11/LICENSE +21 -0
  2. forecast_evaluation-0.0.11/PKG-INFO +130 -0
  3. forecast_evaluation-0.0.11/README.md +92 -0
  4. forecast_evaluation-0.0.11/pyproject.toml +103 -0
  5. forecast_evaluation-0.0.11/setup.cfg +4 -0
  6. forecast_evaluation-0.0.11/src/forecast_evaluation/__init__.py +100 -0
  7. forecast_evaluation-0.0.11/src/forecast_evaluation/core/__init__.py +14 -0
  8. forecast_evaluation-0.0.11/src/forecast_evaluation/core/ar_p_model.py +770 -0
  9. forecast_evaluation-0.0.11/src/forecast_evaluation/core/main_table.py +159 -0
  10. forecast_evaluation-0.0.11/src/forecast_evaluation/core/outturns_revisions_table.py +60 -0
  11. forecast_evaluation-0.0.11/src/forecast_evaluation/core/random_walk_model.py +317 -0
  12. forecast_evaluation-0.0.11/src/forecast_evaluation/core/revisions_table.py +82 -0
  13. forecast_evaluation-0.0.11/src/forecast_evaluation/core/transformations.py +470 -0
  14. forecast_evaluation-0.0.11/src/forecast_evaluation/dashboard/__init__.py +0 -0
  15. forecast_evaluation-0.0.11/src/forecast_evaluation/dashboard/app.py +7 -0
  16. forecast_evaluation-0.0.11/src/forecast_evaluation/dashboard/create_app.py +113 -0
  17. forecast_evaluation-0.0.11/src/forecast_evaluation/dashboard/tabs/about.py +20 -0
  18. forecast_evaluation-0.0.11/src/forecast_evaluation/dashboard/tabs/accuracy.py +519 -0
  19. forecast_evaluation-0.0.11/src/forecast_evaluation/dashboard/tabs/bias.py +329 -0
  20. forecast_evaluation-0.0.11/src/forecast_evaluation/dashboard/tabs/correlation.py +188 -0
  21. forecast_evaluation-0.0.11/src/forecast_evaluation/dashboard/tabs/efficiency.py +218 -0
  22. forecast_evaluation-0.0.11/src/forecast_evaluation/dashboard/tabs/hedgehog.py +65 -0
  23. forecast_evaluation-0.0.11/src/forecast_evaluation/dashboard/tabs/outturn_revisions.py +142 -0
  24. forecast_evaluation-0.0.11/src/forecast_evaluation/dashboard/tabs/quantile_time_machine.py +84 -0
  25. forecast_evaluation-0.0.11/src/forecast_evaluation/dashboard/tabs/radar.py +124 -0
  26. forecast_evaluation-0.0.11/src/forecast_evaluation/dashboard/tabs/time_machine.py +83 -0
  27. forecast_evaluation-0.0.11/src/forecast_evaluation/dashboard/theme/_brand.yml +21 -0
  28. forecast_evaluation-0.0.11/src/forecast_evaluation/dashboard/theme/brand.py +13 -0
  29. forecast_evaluation-0.0.11/src/forecast_evaluation/dashboard/ui.py +853 -0
  30. forecast_evaluation-0.0.11/src/forecast_evaluation/dashboard/utils.py +138 -0
  31. forecast_evaluation-0.0.11/src/forecast_evaluation/data/DensityForecastData.py +607 -0
  32. forecast_evaluation-0.0.11/src/forecast_evaluation/data/ForecastData.py +1410 -0
  33. forecast_evaluation-0.0.11/src/forecast_evaluation/data/__init__.py +6 -0
  34. forecast_evaluation-0.0.11/src/forecast_evaluation/data/_plotting_mixin.py +478 -0
  35. forecast_evaluation-0.0.11/src/forecast_evaluation/data/files/fer_forecasts.parquet +0 -0
  36. forecast_evaluation-0.0.11/src/forecast_evaluation/data/files/fer_forecasts_minimal.parquet +0 -0
  37. forecast_evaluation-0.0.11/src/forecast_evaluation/data/files/fer_outturns.parquet +0 -0
  38. forecast_evaluation-0.0.11/src/forecast_evaluation/data/files/fer_outturns_minimal.parquet +0 -0
  39. forecast_evaluation-0.0.11/src/forecast_evaluation/data/loader.py +51 -0
  40. forecast_evaluation-0.0.11/src/forecast_evaluation/data/sample_data.py +124 -0
  41. forecast_evaluation-0.0.11/src/forecast_evaluation/data/schema.py +84 -0
  42. forecast_evaluation-0.0.11/src/forecast_evaluation/data/utils.py +214 -0
  43. forecast_evaluation-0.0.11/src/forecast_evaluation/tests/__init__.py +31 -0
  44. forecast_evaluation-0.0.11/src/forecast_evaluation/tests/accuracy.py +313 -0
  45. forecast_evaluation-0.0.11/src/forecast_evaluation/tests/bias.py +286 -0
  46. forecast_evaluation-0.0.11/src/forecast_evaluation/tests/blanchard_leigh.py +307 -0
  47. forecast_evaluation-0.0.11/src/forecast_evaluation/tests/correlation.py +181 -0
  48. forecast_evaluation-0.0.11/src/forecast_evaluation/tests/diebold_mariano.py +269 -0
  49. forecast_evaluation-0.0.11/src/forecast_evaluation/tests/fluctuation_tests.py +213 -0
  50. forecast_evaluation-0.0.11/src/forecast_evaluation/tests/results.py +599 -0
  51. forecast_evaluation-0.0.11/src/forecast_evaluation/tests/revisions_errors_correlation.py +244 -0
  52. forecast_evaluation-0.0.11/src/forecast_evaluation/tests/revisions_predictability.py +249 -0
  53. forecast_evaluation-0.0.11/src/forecast_evaluation/tests/rolling_analysis.py +145 -0
  54. forecast_evaluation-0.0.11/src/forecast_evaluation/tests/strong_efficiency.py +274 -0
  55. forecast_evaluation-0.0.11/src/forecast_evaluation/tests/weak_efficiency.py +319 -0
  56. forecast_evaluation-0.0.11/src/forecast_evaluation/utils.py +286 -0
  57. forecast_evaluation-0.0.11/src/forecast_evaluation/visualisations/__init__.py +38 -0
  58. forecast_evaluation-0.0.11/src/forecast_evaluation/visualisations/accuracy.py +432 -0
  59. forecast_evaluation-0.0.11/src/forecast_evaluation/visualisations/bias.py +286 -0
  60. forecast_evaluation-0.0.11/src/forecast_evaluation/visualisations/blanchard_leigh.py +89 -0
  61. forecast_evaluation-0.0.11/src/forecast_evaluation/visualisations/correlation.py +271 -0
  62. forecast_evaluation-0.0.11/src/forecast_evaluation/visualisations/density_plots.py +190 -0
  63. forecast_evaluation-0.0.11/src/forecast_evaluation/visualisations/errors.py +227 -0
  64. forecast_evaluation-0.0.11/src/forecast_evaluation/visualisations/forecast.py +186 -0
  65. forecast_evaluation-0.0.11/src/forecast_evaluation/visualisations/forecast_errors.py +412 -0
  66. forecast_evaluation-0.0.11/src/forecast_evaluation/visualisations/hedgehog.py +173 -0
  67. forecast_evaluation-0.0.11/src/forecast_evaluation/visualisations/outturn_revisions.py +283 -0
  68. forecast_evaluation-0.0.11/src/forecast_evaluation/visualisations/radar.py +467 -0
  69. forecast_evaluation-0.0.11/src/forecast_evaluation/visualisations/revisions_predictability.py +78 -0
  70. forecast_evaluation-0.0.11/src/forecast_evaluation/visualisations/strong_efficiency.py +92 -0
  71. forecast_evaluation-0.0.11/src/forecast_evaluation/visualisations/theme.py +80 -0
  72. forecast_evaluation-0.0.11/src/forecast_evaluation.egg-info/PKG-INFO +130 -0
  73. forecast_evaluation-0.0.11/src/forecast_evaluation.egg-info/SOURCES.txt +90 -0
  74. forecast_evaluation-0.0.11/src/forecast_evaluation.egg-info/dependency_links.txt +1 -0
  75. forecast_evaluation-0.0.11/src/forecast_evaluation.egg-info/requires.txt +19 -0
  76. forecast_evaluation-0.0.11/src/forecast_evaluation.egg-info/top_level.txt +1 -0
  77. forecast_evaluation-0.0.11/tests/test_DM_test.py +204 -0
  78. forecast_evaluation-0.0.11/tests/test_accuracy.py +450 -0
  79. forecast_evaluation-0.0.11/tests/test_ar_p_model.py +121 -0
  80. forecast_evaluation-0.0.11/tests/test_bias.py +637 -0
  81. forecast_evaluation-0.0.11/tests/test_correlation.py +18 -0
  82. forecast_evaluation-0.0.11/tests/test_dashboard.py +38 -0
  83. forecast_evaluation-0.0.11/tests/test_data_class.py +996 -0
  84. forecast_evaluation-0.0.11/tests/test_density_data_class.py +417 -0
  85. forecast_evaluation-0.0.11/tests/test_ensure_consistent.py +209 -0
  86. forecast_evaluation-0.0.11/tests/test_first_forecast_horizon.py +340 -0
  87. forecast_evaluation-0.0.11/tests/test_no_outturn_vintages.py +509 -0
  88. forecast_evaluation-0.0.11/tests/test_plotting_mixin.py +200 -0
  89. forecast_evaluation-0.0.11/tests/test_random_walk_model.py +78 -0
  90. forecast_evaluation-0.0.11/tests/test_result_classes.py +299 -0
  91. forecast_evaluation-0.0.11/tests/test_summary.py +93 -0
  92. forecast_evaluation-0.0.11/tests/test_transformation.py +139 -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,130 @@
1
+ Metadata-Version: 2.4
2
+ Name: forecast_evaluation
3
+ Version: 0.0.11
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: Programming Language :: Python :: 3.14
15
+ Classifier: Operating System :: OS Independent
16
+ Requires-Python: >=3.10
17
+ Description-Content-Type: text/markdown
18
+ License-File: LICENSE
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: pyarrow>=14.0.0; extra == "dev"
30
+ Requires-Dist: pre_commit>=4.3.0; extra == "dev"
31
+ Requires-Dist: pytest>=8.4.1; extra == "dev"
32
+ Requires-Dist: syrupy; extra == "dev"
33
+ Requires-Dist: ruff>=0.13.1; extra == "dev"
34
+ Requires-Dist: Sphinx>=8.2.3; extra == "dev"
35
+ Requires-Dist: sphinx-book-theme>=1.1.4; extra == "dev"
36
+ Requires-Dist: IPython>=9.4.0; extra == "dev"
37
+ Dynamic: license-file
38
+
39
+ [![PyPI](https://img.shields.io/pypi/v/forecast_evaluation?label=pypi%20package)](https://pypi.org/project/forecast-evaluation/)
40
+ [![PyPI - Downloads](https://img.shields.io/pypi/dm/forecast_evaluation)](https://pypistats.org/packages/forecast-evaluation)
41
+
42
+ # Forecast Evaluation Package
43
+
44
+ A Python package for analysing and visualising economic forecast data.
45
+
46
+ ## Installation
47
+
48
+ #### Installing from PyPI
49
+ ```sh
50
+ pip install forecast_evaluation
51
+ ```
52
+
53
+ #### Installing the development version
54
+ ```sh
55
+ git clone https://github.com/bank-of-england/forecast_evaluation.git
56
+ cd forecast_evaluation
57
+ pip install -e .
58
+ ```
59
+
60
+ ## Documentation
61
+
62
+ The package documentation can be found [here](https://bank-of-england.github.io/forecast_evaluation/) with examples on how
63
+ to use the package in this [notebook](https://github.com/bank-of-england/forecast_evaluation/blob/main/notebooks/example_notebook.ipynb).
64
+
65
+
66
+ ## Features
67
+ 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 for forecast evaluation. In handles both point forecasts (with the `ForecastData` object) and density forecasts (with the `DensityForecastData` object).
68
+
69
+ ### Visualisation for forecasts, outturns and errors:
70
+ * Forecast vintages plot
71
+ * Accuracy and bias plots (average and rolling averages)
72
+ * Hedgehog plots
73
+ * Outturn revisions
74
+ * Forecast error distributions
75
+ * Forecast error correlation
76
+ * Radar plots
77
+
78
+ ### Statistical tests
79
+ * Accuracy analysis (Diebold-Mariano test)
80
+ * Bias analysis (Mincer-Zarnowitz Regression)
81
+ * Weak Efficiency analysis (Revision predictability)
82
+ * Strong Efficiency analysis (Blanchard-Leigh regression)
83
+ * Testing correlation between forecast revisions and forecast errors
84
+ * Rolling-window analysis of most tests with fluctuation tests.
85
+
86
+ ### Accuracy metrics available
87
+ * Root mean square error
88
+ * Mean absolute error
89
+ * Median absolute error
90
+
91
+ All of the above features can be explored interactively in a dashboard.
92
+
93
+ ## Loading data
94
+
95
+ ### Data format
96
+ The forecasts should be in a `pandas` dataframe format with the following structure:
97
+ ```
98
+ date vintage_date variable source frequency forecast_horizon value
99
+ 0 2014-12-31 2015-03-31 gdp BVAR Q -1 100
100
+ 1 2015-03-31 2015-03-31 gdp BVAR Q 0 101
101
+ 2 2015-06-30 2015-03-31 gdp BVAR Q 1 102
102
+ 3 2015-09-30 2015-03-31 gdp BVAR Q 2 103
103
+ ```
104
+
105
+ Outturns follow the same structure but do not contain a `source` column.
106
+
107
+ ### Creating a ForecastData instance
108
+ 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:
109
+
110
+ ```python
111
+ import forecast_evaluation as fe
112
+
113
+ forecast_data = fe.ForecastData(forecasts_data=forecasts_dataframe, outturns_data=outturns_dataframe)
114
+ ```
115
+
116
+ The package also comes with built-in data used in the Bank of England 2026 Forecast Evaluation Report which can be loaded with:
117
+ ```python
118
+ forecast_data = fe.ForecastData(load_fer=True)
119
+ ```
120
+
121
+ The forecast_data object has methods to filter, analyse and visualise the data and resulting analysis. These are illustrated in the [example notebook](https://github.com/bank-of-england/forecast_evaluation/blob/main/notebooks/example_notebook.ipynb).
122
+
123
+ Results from the Bank of England 2026 Forecast Evaluation [Macro Technical Paper](https://www.bankofengland.co.uk/macro-technical-paper/2026/learning-from-forecast-errors-the-banks-enhanced-approach-to-forecast-evaluation) can also be replicated with [this notebook](https://github.com/bank-of-england/forecast_evaluation/blob/main/notebooks/mtp_replication_notebook.ipynb).
124
+
125
+
126
+ ## Run the dashboard
127
+ 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:
128
+ ```python
129
+ forecast_data.run_dashboard()
130
+ ```
@@ -0,0 +1,92 @@
1
+ [![PyPI](https://img.shields.io/pypi/v/forecast_evaluation?label=pypi%20package)](https://pypi.org/project/forecast-evaluation/)
2
+ [![PyPI - Downloads](https://img.shields.io/pypi/dm/forecast_evaluation)](https://pypistats.org/packages/forecast-evaluation)
3
+
4
+ # Forecast Evaluation Package
5
+
6
+ A Python package for analysing and visualising economic forecast data.
7
+
8
+ ## Installation
9
+
10
+ #### Installing from PyPI
11
+ ```sh
12
+ pip install forecast_evaluation
13
+ ```
14
+
15
+ #### Installing the development version
16
+ ```sh
17
+ git clone https://github.com/bank-of-england/forecast_evaluation.git
18
+ cd forecast_evaluation
19
+ pip install -e .
20
+ ```
21
+
22
+ ## Documentation
23
+
24
+ The package documentation can be found [here](https://bank-of-england.github.io/forecast_evaluation/) with examples on how
25
+ to use the package in this [notebook](https://github.com/bank-of-england/forecast_evaluation/blob/main/notebooks/example_notebook.ipynb).
26
+
27
+
28
+ ## Features
29
+ 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 for forecast evaluation. In handles both point forecasts (with the `ForecastData` object) and density forecasts (with the `DensityForecastData` object).
30
+
31
+ ### Visualisation for forecasts, outturns and errors:
32
+ * Forecast vintages plot
33
+ * Accuracy and bias plots (average and rolling averages)
34
+ * Hedgehog plots
35
+ * Outturn revisions
36
+ * Forecast error distributions
37
+ * Forecast error correlation
38
+ * Radar plots
39
+
40
+ ### Statistical tests
41
+ * Accuracy analysis (Diebold-Mariano test)
42
+ * Bias analysis (Mincer-Zarnowitz Regression)
43
+ * Weak Efficiency analysis (Revision predictability)
44
+ * Strong Efficiency analysis (Blanchard-Leigh regression)
45
+ * Testing correlation between forecast revisions and forecast errors
46
+ * Rolling-window analysis of most tests with fluctuation tests.
47
+
48
+ ### Accuracy metrics available
49
+ * Root mean square error
50
+ * Mean absolute error
51
+ * Median absolute error
52
+
53
+ All of the above features can be explored interactively in a dashboard.
54
+
55
+ ## Loading data
56
+
57
+ ### Data format
58
+ The forecasts should be in a `pandas` dataframe format with the following structure:
59
+ ```
60
+ date vintage_date variable source frequency forecast_horizon value
61
+ 0 2014-12-31 2015-03-31 gdp BVAR Q -1 100
62
+ 1 2015-03-31 2015-03-31 gdp BVAR Q 0 101
63
+ 2 2015-06-30 2015-03-31 gdp BVAR Q 1 102
64
+ 3 2015-09-30 2015-03-31 gdp BVAR Q 2 103
65
+ ```
66
+
67
+ Outturns follow the same structure but do not contain a `source` column.
68
+
69
+ ### Creating a ForecastData instance
70
+ 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:
71
+
72
+ ```python
73
+ import forecast_evaluation as fe
74
+
75
+ forecast_data = fe.ForecastData(forecasts_data=forecasts_dataframe, outturns_data=outturns_dataframe)
76
+ ```
77
+
78
+ The package also comes with built-in data used in the Bank of England 2026 Forecast Evaluation Report which can be loaded with:
79
+ ```python
80
+ forecast_data = fe.ForecastData(load_fer=True)
81
+ ```
82
+
83
+ The forecast_data object has methods to filter, analyse and visualise the data and resulting analysis. These are illustrated in the [example notebook](https://github.com/bank-of-england/forecast_evaluation/blob/main/notebooks/example_notebook.ipynb).
84
+
85
+ Results from the Bank of England 2026 Forecast Evaluation [Macro Technical Paper](https://www.bankofengland.co.uk/macro-technical-paper/2026/learning-from-forecast-errors-the-banks-enhanced-approach-to-forecast-evaluation) can also be replicated with [this notebook](https://github.com/bank-of-england/forecast_evaluation/blob/main/notebooks/mtp_replication_notebook.ipynb).
86
+
87
+
88
+ ## Run the dashboard
89
+ 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:
90
+ ```python
91
+ forecast_data.run_dashboard()
92
+ ```
@@ -0,0 +1,103 @@
1
+ [project]
2
+ name = "forecast_evaluation"
3
+ version = "0.0.11"
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
+ "Programming Language :: Python :: 3.14",
25
+ "Operating System :: OS Independent",
26
+ ]
27
+
28
+ dependencies = [
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
+ "pyarrow>=14.0.0",
43
+ "pre_commit>=4.3.0",
44
+ "pytest>=8.4.1",
45
+ "syrupy",
46
+ "ruff>=0.13.1",
47
+ "Sphinx>=8.2.3",
48
+ "sphinx-book-theme>=1.1.4",
49
+ "IPython>=9.4.0",
50
+ ]
51
+
52
+ [project.urls]
53
+ Homepage = "https://github.com/bank-of-england/forecast_evaluation"
54
+ Issues = "https://github.com/bank-of-england/forecast_evaluation/issues"
55
+
56
+ [build-system]
57
+ requires = ["setuptools"]
58
+ build-backend = "setuptools.build_meta"
59
+
60
+ [tool.setuptools.package-data]
61
+ forecast_evaluation = ["data/files/*.parquet", "dashboard/theme/*.yml", "dashboard/theme/*.png"]
62
+
63
+ [tool.setuptools]
64
+ include-package-data = true
65
+
66
+ [tool.ruff]
67
+ line-length = 120
68
+ target-version = "py39"
69
+
70
+ [tool.ruff.lint]
71
+ # Enable specific rules
72
+ select = [
73
+ "E", # pycodestyle
74
+ "F", # pyflakes
75
+ "I", # isort
76
+ "UP", # pyupgrade
77
+ ]
78
+
79
+ # Ignore specific rules
80
+ ignore = [
81
+ "D100", # Missing docstring in public module
82
+ "D104", # Missing docstring in public package,
83
+ "D213",
84
+ "D211"
85
+ ]
86
+
87
+ # Exclude files and directories
88
+ exclude = [
89
+ ".git",
90
+ ".ruff_cache",
91
+ "__pycache__",
92
+ "build",
93
+ "dist",
94
+ "notebooks",
95
+ "notebooks/**",
96
+ "src/forecast_evaluation/dashboard/**",
97
+ ]
98
+
99
+ [tool.ruff.lint.per-file-ignores]
100
+ "__init__.py" = ["F401"] # Ignore unused imports in __init__.py files
101
+
102
+ [tool.pytest.ini_options]
103
+ testpaths = ["tests"]
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,100 @@
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
+ forecast_errors_correlation_analysis,
21
+ revision_predictability_analysis,
22
+ revisions_errors_correlation_analysis,
23
+ rolling_analysis,
24
+ strong_efficiency_analysis,
25
+ weak_efficiency_analysis,
26
+ )
27
+ from .utils import covid_filter, filter_k, reconstruct_id_cols_from_unique_id
28
+ from .visualisations import (
29
+ plot_accuracy,
30
+ plot_average_revision_by_period,
31
+ plot_bias_by_horizon,
32
+ plot_blanchard_leigh_ratios,
33
+ plot_compare_to_benchmark,
34
+ plot_correlation_heatmap,
35
+ plot_errors_across_time,
36
+ plot_forecast_error_density,
37
+ plot_forecast_errors,
38
+ plot_forecast_errors_by_horizon,
39
+ plot_hedgehog,
40
+ plot_outturn_revisions,
41
+ plot_outturns,
42
+ plot_radar,
43
+ plot_rolling_bias,
44
+ plot_rolling_correlation,
45
+ plot_rolling_relative_accuracy,
46
+ plot_strong_efficiency,
47
+ plot_vintage,
48
+ )
49
+
50
+ __all__ = [
51
+ # Core functions
52
+ "create_outturn_revisions",
53
+ "add_random_walk_forecasts",
54
+ "add_ar_p_forecasts",
55
+ # Data classes
56
+ "ForecastData",
57
+ "DensityForecastData",
58
+ # Sample data functions
59
+ "create_sample_forecasts",
60
+ "create_sample_outturns",
61
+ # Test/analysis functions
62
+ "bias_analysis",
63
+ "blanchard_leigh_horizon_analysis",
64
+ "compare_to_benchmark",
65
+ "compute_accuracy_statistics",
66
+ "create_comparison_table",
67
+ "diebold_mariano_table",
68
+ "fluctuation_tests",
69
+ "forecast_errors_correlation_analysis",
70
+ "revisions_errors_correlation_analysis",
71
+ "revision_predictability_analysis",
72
+ "rolling_analysis",
73
+ "strong_efficiency_analysis",
74
+ "weak_efficiency_analysis",
75
+ # Visualisation functions
76
+ "plot_accuracy",
77
+ "plot_average_revision_by_period",
78
+ "plot_blanchard_leigh_ratios",
79
+ "plot_compare_to_benchmark",
80
+ "plot_correlation_heatmap",
81
+ "plot_strong_efficiency",
82
+ "plot_forecast_error_density",
83
+ "plot_forecast_errors",
84
+ "plot_forecast_errors_by_horizon",
85
+ "plot_hedgehog",
86
+ "plot_outturn_revisions",
87
+ "plot_outturns",
88
+ "plot_radar",
89
+ "plot_rolling_bias",
90
+ "plot_rolling_correlation",
91
+ "plot_rolling_relative_accuracy",
92
+ "plot_bias_by_horizon",
93
+ "plot_vintage",
94
+ "plot_errors_across_time",
95
+ # Utility functions
96
+ "covid_filter",
97
+ "filter_fer_variables",
98
+ "filter_k",
99
+ "reconstruct_id_cols_from_unique_id",
100
+ ]
@@ -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
+ ]