openstef 3.4.63__tar.gz → 3.4.65__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 (110) hide show
  1. {openstef-3.4.63 → openstef-3.4.65}/PKG-INFO +35 -6
  2. {openstef-3.4.63 → openstef-3.4.65}/README.md +28 -4
  3. {openstef-3.4.63 → openstef-3.4.65}/openstef/data_classes/prediction_job.py +4 -0
  4. {openstef-3.4.63 → openstef-3.4.65}/openstef/exceptions.py +2 -2
  5. {openstef-3.4.63 → openstef-3.4.65}/openstef/pipeline/create_basecase_forecast.py +3 -3
  6. {openstef-3.4.63 → openstef-3.4.65}/openstef/pipeline/create_forecast.py +3 -2
  7. {openstef-3.4.63 → openstef-3.4.65}/openstef/pipeline/optimize_hyperparameters.py +2 -1
  8. {openstef-3.4.63 → openstef-3.4.65}/openstef/pipeline/train_create_forecast_backtest.py +1 -1
  9. {openstef-3.4.63 → openstef-3.4.65}/openstef/pipeline/train_model.py +4 -3
  10. openstef-3.4.65/openstef/plotting/__init__.py +3 -0
  11. openstef-3.4.65/openstef/plotting/load_forecast_plotter.py +216 -0
  12. {openstef-3.4.63 → openstef-3.4.65}/openstef/tasks/create_forecast.py +8 -8
  13. {openstef-3.4.63 → openstef-3.4.65}/openstef/tasks/train_model.py +6 -6
  14. {openstef-3.4.63 → openstef-3.4.65}/openstef/validation/validation.py +36 -13
  15. {openstef-3.4.63 → openstef-3.4.65}/openstef.egg-info/PKG-INFO +35 -6
  16. {openstef-3.4.63 → openstef-3.4.65}/openstef.egg-info/SOURCES.txt +2 -0
  17. {openstef-3.4.63 → openstef-3.4.65}/openstef.egg-info/requires.txt +8 -0
  18. {openstef-3.4.63 → openstef-3.4.65}/setup.py +11 -1
  19. {openstef-3.4.63 → openstef-3.4.65}/LICENSE +0 -0
  20. {openstef-3.4.63 → openstef-3.4.65}/openstef/__init__.py +0 -0
  21. {openstef-3.4.63 → openstef-3.4.65}/openstef/__main__.py +0 -0
  22. {openstef-3.4.63 → openstef-3.4.65}/openstef/app_settings.py +0 -0
  23. {openstef-3.4.63 → openstef-3.4.65}/openstef/data/NL_terrestrial_radiation.csv +0 -0
  24. {openstef-3.4.63 → openstef-3.4.65}/openstef/data/NL_terrestrial_radiation.csv.license +0 -0
  25. {openstef-3.4.63 → openstef-3.4.65}/openstef/data/dazls_model_3.4.24/dazls_stored_3.4.24_baseline_model.z +0 -0
  26. {openstef-3.4.63 → openstef-3.4.65}/openstef/data/dazls_model_3.4.24/dazls_stored_3.4.24_baseline_model.z.license +0 -0
  27. {openstef-3.4.63 → openstef-3.4.65}/openstef/data/dazls_model_3.4.24/dazls_stored_3.4.24_model_card.md +0 -0
  28. {openstef-3.4.63 → openstef-3.4.65}/openstef/data/dazls_model_3.4.24/dazls_stored_3.4.24_model_card.md.license +0 -0
  29. {openstef-3.4.63 → openstef-3.4.65}/openstef/data/dutch_holidays.csv +0 -0
  30. {openstef-3.4.63 → openstef-3.4.65}/openstef/data/dutch_holidays.csv.license +0 -0
  31. {openstef-3.4.63 → openstef-3.4.65}/openstef/data/pv_single_coefs.csv +0 -0
  32. {openstef-3.4.63 → openstef-3.4.65}/openstef/data/pv_single_coefs.csv.license +0 -0
  33. {openstef-3.4.63 → openstef-3.4.65}/openstef/data_classes/__init__.py +0 -0
  34. {openstef-3.4.63 → openstef-3.4.65}/openstef/data_classes/data_prep.py +0 -0
  35. {openstef-3.4.63 → openstef-3.4.65}/openstef/data_classes/model_specifications.py +0 -0
  36. {openstef-3.4.63 → openstef-3.4.65}/openstef/data_classes/split_function.py +0 -0
  37. {openstef-3.4.63 → openstef-3.4.65}/openstef/enums.py +0 -0
  38. {openstef-3.4.63 → openstef-3.4.65}/openstef/feature_engineering/__init__.py +0 -0
  39. {openstef-3.4.63 → openstef-3.4.65}/openstef/feature_engineering/apply_features.py +0 -0
  40. {openstef-3.4.63 → openstef-3.4.65}/openstef/feature_engineering/bidding_zone_to_country_mapping.py +0 -0
  41. {openstef-3.4.63 → openstef-3.4.65}/openstef/feature_engineering/cyclic_features.py +0 -0
  42. {openstef-3.4.63 → openstef-3.4.65}/openstef/feature_engineering/data_preparation.py +0 -0
  43. {openstef-3.4.63 → openstef-3.4.65}/openstef/feature_engineering/feature_adder.py +0 -0
  44. {openstef-3.4.63 → openstef-3.4.65}/openstef/feature_engineering/feature_applicator.py +0 -0
  45. {openstef-3.4.63 → openstef-3.4.65}/openstef/feature_engineering/general.py +0 -0
  46. {openstef-3.4.63 → openstef-3.4.65}/openstef/feature_engineering/holiday_features.py +0 -0
  47. {openstef-3.4.63 → openstef-3.4.65}/openstef/feature_engineering/lag_features.py +0 -0
  48. {openstef-3.4.63 → openstef-3.4.65}/openstef/feature_engineering/missing_values_transformer.py +0 -0
  49. {openstef-3.4.63 → openstef-3.4.65}/openstef/feature_engineering/rolling_features.py +0 -0
  50. {openstef-3.4.63 → openstef-3.4.65}/openstef/feature_engineering/weather_features.py +0 -0
  51. {openstef-3.4.63 → openstef-3.4.65}/openstef/metrics/__init__.py +0 -0
  52. {openstef-3.4.63 → openstef-3.4.65}/openstef/metrics/figure.py +0 -0
  53. {openstef-3.4.63 → openstef-3.4.65}/openstef/metrics/metrics.py +0 -0
  54. {openstef-3.4.63 → openstef-3.4.65}/openstef/metrics/reporter.py +0 -0
  55. {openstef-3.4.63 → openstef-3.4.65}/openstef/model/__init__.py +0 -0
  56. {openstef-3.4.63 → openstef-3.4.65}/openstef/model/basecase.py +0 -0
  57. {openstef-3.4.63 → openstef-3.4.65}/openstef/model/confidence_interval_applicator.py +0 -0
  58. {openstef-3.4.63 → openstef-3.4.65}/openstef/model/fallback.py +0 -0
  59. {openstef-3.4.63 → openstef-3.4.65}/openstef/model/metamodels/__init__.py +0 -0
  60. {openstef-3.4.63 → openstef-3.4.65}/openstef/model/metamodels/feature_clipper.py +0 -0
  61. {openstef-3.4.63 → openstef-3.4.65}/openstef/model/metamodels/grouped_regressor.py +0 -0
  62. {openstef-3.4.63 → openstef-3.4.65}/openstef/model/metamodels/missing_values_handler.py +0 -0
  63. {openstef-3.4.63 → openstef-3.4.65}/openstef/model/model_creator.py +0 -0
  64. {openstef-3.4.63 → openstef-3.4.65}/openstef/model/objective.py +0 -0
  65. {openstef-3.4.63 → openstef-3.4.65}/openstef/model/objective_creator.py +0 -0
  66. {openstef-3.4.63 → openstef-3.4.65}/openstef/model/regressors/__init__.py +0 -0
  67. {openstef-3.4.63 → openstef-3.4.65}/openstef/model/regressors/arima.py +0 -0
  68. {openstef-3.4.63 → openstef-3.4.65}/openstef/model/regressors/custom_regressor.py +0 -0
  69. {openstef-3.4.63 → openstef-3.4.65}/openstef/model/regressors/dazls.py +0 -0
  70. {openstef-3.4.63 → openstef-3.4.65}/openstef/model/regressors/flatliner.py +0 -0
  71. {openstef-3.4.63 → openstef-3.4.65}/openstef/model/regressors/gblinear_quantile.py +0 -0
  72. {openstef-3.4.63 → openstef-3.4.65}/openstef/model/regressors/lgbm.py +0 -0
  73. {openstef-3.4.63 → openstef-3.4.65}/openstef/model/regressors/linear.py +0 -0
  74. {openstef-3.4.63 → openstef-3.4.65}/openstef/model/regressors/linear_quantile.py +0 -0
  75. {openstef-3.4.63 → openstef-3.4.65}/openstef/model/regressors/regressor.py +0 -0
  76. {openstef-3.4.63 → openstef-3.4.65}/openstef/model/regressors/xgb.py +0 -0
  77. {openstef-3.4.63 → openstef-3.4.65}/openstef/model/regressors/xgb_multioutput_quantile.py +0 -0
  78. {openstef-3.4.63 → openstef-3.4.65}/openstef/model/regressors/xgb_quantile.py +0 -0
  79. {openstef-3.4.63 → openstef-3.4.65}/openstef/model/serializer.py +0 -0
  80. {openstef-3.4.63 → openstef-3.4.65}/openstef/model/standard_deviation_generator.py +0 -0
  81. {openstef-3.4.63 → openstef-3.4.65}/openstef/model_selection/__init__.py +0 -0
  82. {openstef-3.4.63 → openstef-3.4.65}/openstef/model_selection/model_selection.py +0 -0
  83. {openstef-3.4.63 → openstef-3.4.65}/openstef/monitoring/__init__.py +0 -0
  84. {openstef-3.4.63 → openstef-3.4.65}/openstef/monitoring/performance_meter.py +0 -0
  85. {openstef-3.4.63 → openstef-3.4.65}/openstef/monitoring/teams.py +0 -0
  86. {openstef-3.4.63 → openstef-3.4.65}/openstef/pipeline/__init__.py +0 -0
  87. {openstef-3.4.63 → openstef-3.4.65}/openstef/pipeline/create_component_forecast.py +0 -0
  88. {openstef-3.4.63 → openstef-3.4.65}/openstef/pipeline/utils.py +0 -0
  89. {openstef-3.4.63 → openstef-3.4.65}/openstef/postprocessing/__init__.py +0 -0
  90. {openstef-3.4.63 → openstef-3.4.65}/openstef/postprocessing/postprocessing.py +0 -0
  91. {openstef-3.4.63 → openstef-3.4.65}/openstef/preprocessing/__init__.py +0 -0
  92. {openstef-3.4.63 → openstef-3.4.65}/openstef/preprocessing/preprocessing.py +0 -0
  93. {openstef-3.4.63 → openstef-3.4.65}/openstef/settings.py +0 -0
  94. {openstef-3.4.63 → openstef-3.4.65}/openstef/tasks/__init__.py +0 -0
  95. {openstef-3.4.63 → openstef-3.4.65}/openstef/tasks/calculate_kpi.py +0 -0
  96. {openstef-3.4.63 → openstef-3.4.65}/openstef/tasks/create_basecase_forecast.py +0 -0
  97. {openstef-3.4.63 → openstef-3.4.65}/openstef/tasks/create_components_forecast.py +0 -0
  98. {openstef-3.4.63 → openstef-3.4.65}/openstef/tasks/create_solar_forecast.py +0 -0
  99. {openstef-3.4.63 → openstef-3.4.65}/openstef/tasks/create_wind_forecast.py +0 -0
  100. {openstef-3.4.63 → openstef-3.4.65}/openstef/tasks/optimize_hyperparameters.py +0 -0
  101. {openstef-3.4.63 → openstef-3.4.65}/openstef/tasks/split_forecast.py +0 -0
  102. {openstef-3.4.63 → openstef-3.4.65}/openstef/tasks/utils/__init__.py +0 -0
  103. {openstef-3.4.63 → openstef-3.4.65}/openstef/tasks/utils/dependencies.py +0 -0
  104. {openstef-3.4.63 → openstef-3.4.65}/openstef/tasks/utils/predictionjobloop.py +0 -0
  105. {openstef-3.4.63 → openstef-3.4.65}/openstef/tasks/utils/taskcontext.py +0 -0
  106. {openstef-3.4.63 → openstef-3.4.65}/openstef/validation/__init__.py +0 -0
  107. {openstef-3.4.63 → openstef-3.4.65}/openstef.egg-info/dependency_links.txt +0 -0
  108. {openstef-3.4.63 → openstef-3.4.65}/openstef.egg-info/top_level.txt +0 -0
  109. {openstef-3.4.63 → openstef-3.4.65}/pyproject.toml +0 -0
  110. {openstef-3.4.63 → openstef-3.4.65}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: openstef
3
- Version: 3.4.63
3
+ Version: 3.4.65
4
4
  Summary: Open short term energy forecaster
5
5
  Home-page: https://github.com/OpenSTEF/openstef
6
6
  Author: Alliander N.V
@@ -33,7 +33,11 @@ Requires-Dist: scikit-learn<1.6,>=1.3
33
33
  Requires-Dist: scipy~=1.10
34
34
  Requires-Dist: statsmodels<1.0.0,>=0.13.5
35
35
  Requires-Dist: structlog<25,>=23.1
36
- Requires-Dist: xgboost~=2.0
36
+ Requires-Dist: xgboost~=2.0; extra == "gpu"
37
+ Provides-Extra: cpu
38
+ Requires-Dist: xgboost-cpu~=2.0; extra == "cpu"
39
+ Provides-Extra: gpu
40
+ Requires-Dist: xgboost; extra == "gpu"
37
41
  Dynamic: author
38
42
  Dynamic: author-email
39
43
  Dynamic: classifier
@@ -42,6 +46,7 @@ Dynamic: description-content-type
42
46
  Dynamic: home-page
43
47
  Dynamic: keywords
44
48
  Dynamic: license
49
+ Dynamic: provides-extra
45
50
  Dynamic: requires-dist
46
51
  Dynamic: requires-python
47
52
  Dynamic: summary
@@ -53,11 +58,15 @@ SPDX-License-Identifier: MPL-2.0
53
58
  -->
54
59
 
55
60
  # OpenSTEF
61
+
56
62
  <!-- Badges -->
63
+
57
64
  [![Downloads](https://static.pepy.tech/badge/openstef)](https://pepy.tech/project/openstef)
58
65
  [![Downloads](https://static.pepy.tech/badge/openstef/month)](https://pepy.tech/project/openstef)
59
66
  [![CII Best Practices](https://bestpractices.coreinfrastructure.org/projects/5585/badge)](https://bestpractices.coreinfrastructure.org/projects/5585)
67
+
60
68
  <!-- SonarCloud badges -->
69
+
61
70
  [![Bugs](https://sonarcloud.io/api/project_badges/measure?project=OpenSTEF_openstef&metric=bugs)](https://sonarcloud.io/dashboard?id=OpenSTEF_openstef)
62
71
  [![Code Smells](https://sonarcloud.io/api/project_badges/measure?project=OpenSTEF_openstef&metric=code_smells)](https://sonarcloud.io/dashboard?id=OpenSTEF_openstef)
63
72
  [![Coverage](https://sonarcloud.io/api/project_badges/measure?project=OpenSTEF_openstef&metric=coverage)](https://sonarcloud.io/dashboard?id=OpenSTEF_openstef)
@@ -71,19 +80,21 @@ SPDX-License-Identifier: MPL-2.0
71
80
  OpenSTEF is a Python package designed for generating short-term forecasts in the energy sector. The repository includes all the essential components required for machine learning pipelines that facilitate the forecasting process. To utilize the package, users are required to furnish their own data storage and retrieval interface.
72
81
 
73
82
  # Table of contents
83
+
74
84
  - [OpenSTEF](#openstef)
75
85
  - [Table of contents](#table-of-contents)
76
86
  - [External information sources](#external-information-sources)
77
87
  - [Installation](#installation)
78
88
  - [Usage](#usage)
79
- - [Example notebooks](#example-notebooks)
80
- - [Reference Implementation](#reference-implementation)
81
- - [Database connector for OpenSTEF](#database-connector-for-openstef)
89
+ - [Example notebooks](#example-notebooks)
90
+ - [Reference Implementation](#reference-implementation)
91
+ - [Database connector for OpenSTEF](#database-connector-for-openstef)
82
92
  - [License](license)
83
93
  - [Contributing](#contributing)
84
94
  - [Contact](#contact)
85
95
 
86
96
  # External information sources
97
+
87
98
  - [Documentation website](https://openstef.github.io/openstef/index.html);
88
99
  - [Python package](https://pypi.org/project/openstef/);
89
100
  - [Linux Foundation project page](https://www.lfenergy.org/projects/openstef/);
@@ -101,9 +112,11 @@ pip install openstef
101
112
  ### Remark regarding installation within a **conda environment on Windows**
102
113
 
103
114
  A version of the pywin32 package will be installed as a secondary dependency along with the installation of the openstef package. Since conda relies on an old version of pywin32, the new installation can break conda's functionality. The following command can solve this issue:
115
+
104
116
  ```shell
105
117
  pip install pywin32==300
106
118
  ```
119
+
107
120
  For more information on this issue see the [readme of pywin32](https://github.com/mhammond/pywin32#installing-via-pip) or [this Github issue](https://github.com/mhammond/pywin32/issues/1865#issue-1212752696).
108
121
 
109
122
  ## Remark regarding installation on Apple Silicon
@@ -112,19 +125,31 @@ If you want to install the `openstef` package on Apple Silicon (Mac with M1-chip
112
125
 
113
126
  1. Run `brew install libomp` (if you haven’t installed Homebrew: [follow instructions here](https://brew.sh/))
114
127
  2. If your interpreter can not find the `libomp` installation in `/usr/local/bin`, it is probably in `/opt/brew/Cellar`. Run:
128
+
115
129
  ```sh
116
130
  mkdir -p /usr/local/opt/libomp/
117
131
  ln -s /opt/brew/Cellar/libomp/{your_version}/lib /usr/local/opt/libomp/lib
118
132
  ```
133
+
119
134
  3. Uninstall `xgboost` with `pip` (`pip uninstall xgboost`) and install with `conda-forge` (`conda install -c conda-forge xgboost`)
120
135
  4. If you encounter similar issues with `lightgbm`: uninstall `lightgbm` with `pip` (`pip uninstall lightgbm`) and install later version with `conda-forge` (`conda install -c conda-forge 'lightgbm>=4.2.0'`)
121
136
 
137
+ ### Remark regarding installation with minimal XGBoost dependency
138
+
139
+ It is possible to install openSTEF with a minimal XGBoost (CPU-only) package. This only works on x86_64 (amd64) Linux and Windows platforms. Advantage is that significantly smaller dependencies are installed. In that case run:
140
+
141
+ ```shell
142
+ pip install openstef[cpu]
143
+ ```
144
+
122
145
  # Usage
123
146
 
124
147
  ## Example notebooks
148
+
125
149
  To help you get started, a set of fundamental example notebooks has been created. You can access these offline examples [here](https://github.com/OpenSTEF/openstef-offline-example).
126
150
 
127
151
  ## Reference Implementation
152
+
128
153
  A complete implementation including databases, user interface, example data, etc. is available at: https://github.com/OpenSTEF/openstef-reference
129
154
 
130
155
  ![screenshot](https://user-images.githubusercontent.com/60883372/146760483-29af3ac7-62af-4f13-98c7-982a79c517d1.jpg)
@@ -138,17 +163,21 @@ python -m openstef task <task_name>
138
163
  ```
139
164
 
140
165
  ## Database connector for openstef
166
+
141
167
  This repository provides an interface to OpenSTEF (reference) databases. The repository can be found [here](https://github.com/OpenSTEF/openstef-dbc).
142
168
 
143
169
  # License
170
+
144
171
  This project is licensed under the Mozilla Public License, version 2.0 - see LICENSE for details.
145
172
 
146
173
  ## Licenses third-party libraries
174
+
147
175
  This project includes third-party libraries, which are licensed under their own respective Open-Source licenses. SPDX-License-Identifier headers are used to show which license is applicable. The concerning license files can be found in the LICENSES directory.
148
176
 
149
177
  # Contributing
178
+
150
179
  Please read [CODE_OF_CONDUCT.md](https://github.com/OpenSTEF/.github/blob/main/CODE_OF_CONDUCT.md), [CONTRIBUTING.md](https://github.com/OpenSTEF/.github/blob/main/CONTRIBUTING.md) and [PROJECT_GOVERNANCE.md](https://github.com/OpenSTEF/.github/blob/main/PROJECT_GOVERNANCE.md) for details on the process for submitting pull requests to us.
151
180
 
152
181
  # Contact
182
+
153
183
  Please read [SUPPORT.md](https://github.com/OpenSTEF/.github/blob/main/SUPPORT.md) for how to connect and get into contact with the OpenSTEF project
154
-
@@ -5,11 +5,15 @@ SPDX-License-Identifier: MPL-2.0
5
5
  -->
6
6
 
7
7
  # OpenSTEF
8
+
8
9
  <!-- Badges -->
10
+
9
11
  [![Downloads](https://static.pepy.tech/badge/openstef)](https://pepy.tech/project/openstef)
10
12
  [![Downloads](https://static.pepy.tech/badge/openstef/month)](https://pepy.tech/project/openstef)
11
13
  [![CII Best Practices](https://bestpractices.coreinfrastructure.org/projects/5585/badge)](https://bestpractices.coreinfrastructure.org/projects/5585)
14
+
12
15
  <!-- SonarCloud badges -->
16
+
13
17
  [![Bugs](https://sonarcloud.io/api/project_badges/measure?project=OpenSTEF_openstef&metric=bugs)](https://sonarcloud.io/dashboard?id=OpenSTEF_openstef)
14
18
  [![Code Smells](https://sonarcloud.io/api/project_badges/measure?project=OpenSTEF_openstef&metric=code_smells)](https://sonarcloud.io/dashboard?id=OpenSTEF_openstef)
15
19
  [![Coverage](https://sonarcloud.io/api/project_badges/measure?project=OpenSTEF_openstef&metric=coverage)](https://sonarcloud.io/dashboard?id=OpenSTEF_openstef)
@@ -23,19 +27,21 @@ SPDX-License-Identifier: MPL-2.0
23
27
  OpenSTEF is a Python package designed for generating short-term forecasts in the energy sector. The repository includes all the essential components required for machine learning pipelines that facilitate the forecasting process. To utilize the package, users are required to furnish their own data storage and retrieval interface.
24
28
 
25
29
  # Table of contents
30
+
26
31
  - [OpenSTEF](#openstef)
27
32
  - [Table of contents](#table-of-contents)
28
33
  - [External information sources](#external-information-sources)
29
34
  - [Installation](#installation)
30
35
  - [Usage](#usage)
31
- - [Example notebooks](#example-notebooks)
32
- - [Reference Implementation](#reference-implementation)
33
- - [Database connector for OpenSTEF](#database-connector-for-openstef)
36
+ - [Example notebooks](#example-notebooks)
37
+ - [Reference Implementation](#reference-implementation)
38
+ - [Database connector for OpenSTEF](#database-connector-for-openstef)
34
39
  - [License](license)
35
40
  - [Contributing](#contributing)
36
41
  - [Contact](#contact)
37
42
 
38
43
  # External information sources
44
+
39
45
  - [Documentation website](https://openstef.github.io/openstef/index.html);
40
46
  - [Python package](https://pypi.org/project/openstef/);
41
47
  - [Linux Foundation project page](https://www.lfenergy.org/projects/openstef/);
@@ -53,9 +59,11 @@ pip install openstef
53
59
  ### Remark regarding installation within a **conda environment on Windows**
54
60
 
55
61
  A version of the pywin32 package will be installed as a secondary dependency along with the installation of the openstef package. Since conda relies on an old version of pywin32, the new installation can break conda's functionality. The following command can solve this issue:
62
+
56
63
  ```shell
57
64
  pip install pywin32==300
58
65
  ```
66
+
59
67
  For more information on this issue see the [readme of pywin32](https://github.com/mhammond/pywin32#installing-via-pip) or [this Github issue](https://github.com/mhammond/pywin32/issues/1865#issue-1212752696).
60
68
 
61
69
  ## Remark regarding installation on Apple Silicon
@@ -64,19 +72,31 @@ If you want to install the `openstef` package on Apple Silicon (Mac with M1-chip
64
72
 
65
73
  1. Run `brew install libomp` (if you haven’t installed Homebrew: [follow instructions here](https://brew.sh/))
66
74
  2. If your interpreter can not find the `libomp` installation in `/usr/local/bin`, it is probably in `/opt/brew/Cellar`. Run:
75
+
67
76
  ```sh
68
77
  mkdir -p /usr/local/opt/libomp/
69
78
  ln -s /opt/brew/Cellar/libomp/{your_version}/lib /usr/local/opt/libomp/lib
70
79
  ```
80
+
71
81
  3. Uninstall `xgboost` with `pip` (`pip uninstall xgboost`) and install with `conda-forge` (`conda install -c conda-forge xgboost`)
72
82
  4. If you encounter similar issues with `lightgbm`: uninstall `lightgbm` with `pip` (`pip uninstall lightgbm`) and install later version with `conda-forge` (`conda install -c conda-forge 'lightgbm>=4.2.0'`)
73
83
 
84
+ ### Remark regarding installation with minimal XGBoost dependency
85
+
86
+ It is possible to install openSTEF with a minimal XGBoost (CPU-only) package. This only works on x86_64 (amd64) Linux and Windows platforms. Advantage is that significantly smaller dependencies are installed. In that case run:
87
+
88
+ ```shell
89
+ pip install openstef[cpu]
90
+ ```
91
+
74
92
  # Usage
75
93
 
76
94
  ## Example notebooks
95
+
77
96
  To help you get started, a set of fundamental example notebooks has been created. You can access these offline examples [here](https://github.com/OpenSTEF/openstef-offline-example).
78
97
 
79
98
  ## Reference Implementation
99
+
80
100
  A complete implementation including databases, user interface, example data, etc. is available at: https://github.com/OpenSTEF/openstef-reference
81
101
 
82
102
  ![screenshot](https://user-images.githubusercontent.com/60883372/146760483-29af3ac7-62af-4f13-98c7-982a79c517d1.jpg)
@@ -90,17 +110,21 @@ python -m openstef task <task_name>
90
110
  ```
91
111
 
92
112
  ## Database connector for openstef
113
+
93
114
  This repository provides an interface to OpenSTEF (reference) databases. The repository can be found [here](https://github.com/OpenSTEF/openstef-dbc).
94
115
 
95
116
  # License
117
+
96
118
  This project is licensed under the Mozilla Public License, version 2.0 - see LICENSE for details.
97
119
 
98
120
  ## Licenses third-party libraries
121
+
99
122
  This project includes third-party libraries, which are licensed under their own respective Open-Source licenses. SPDX-License-Identifier headers are used to show which license is applicable. The concerning license files can be found in the LICENSES directory.
100
123
 
101
124
  # Contributing
125
+
102
126
  Please read [CODE_OF_CONDUCT.md](https://github.com/OpenSTEF/.github/blob/main/CODE_OF_CONDUCT.md), [CONTRIBUTING.md](https://github.com/OpenSTEF/.github/blob/main/CONTRIBUTING.md) and [PROJECT_GOVERNANCE.md](https://github.com/OpenSTEF/.github/blob/main/PROJECT_GOVERNANCE.md) for details on the process for submitting pull requests to us.
103
127
 
104
128
  # Contact
129
+
105
130
  Please read [SUPPORT.md](https://github.com/OpenSTEF/.github/blob/main/SUPPORT.md) for how to connect and get into contact with the OpenSTEF project
106
-
@@ -96,6 +96,10 @@ class PredictionJobDataClass(BaseModel):
96
96
  1440,
97
97
  description="Number of minutes that the load has to be constant to detect a flatliner.",
98
98
  )
99
+ detect_non_zero_flatliner: bool = Field(
100
+ False,
101
+ description="If True, flatliners are also detected on non-zero values (median of the load).",
102
+ )
99
103
  data_balancing_ratio: Optional[float] = Field(
100
104
  None,
101
105
  description="If data balancing is enabled, the data will be balanced with data from 1 year ago in the future.",
@@ -44,8 +44,8 @@ class InputDataWrongColumnOrderError(InputDataInvalidError):
44
44
  """Wrong column order input data."""
45
45
 
46
46
 
47
- class InputDataOngoingZeroFlatlinerError(InputDataInvalidError):
48
- """All recent load measurements are zero."""
47
+ class InputDataOngoingFlatlinerError(InputDataInvalidError):
48
+ """All recent load measurements are constant."""
49
49
 
50
50
 
51
51
  class OldModelHigherScoreError(Exception):
@@ -8,7 +8,7 @@ import pandas as pd
8
8
  import structlog
9
9
 
10
10
  from openstef.data_classes.prediction_job import PredictionJobDataClass
11
- from openstef.exceptions import InputDataOngoingZeroFlatlinerError, NoRealisedLoadError
11
+ from openstef.exceptions import NoRealisedLoadError
12
12
  from openstef.feature_engineering.feature_applicator import (
13
13
  OperationalPredictFeatureApplicator,
14
14
  )
@@ -58,12 +58,12 @@ def create_basecase_forecast_pipeline(
58
58
  if not isinstance(input_data.index, pd.DatetimeIndex):
59
59
  raise ValueError("Input dataframe does not have a datetime index.")
60
60
 
61
- zero_flatliner_ongoing = validation.detect_ongoing_zero_flatliner(
61
+ flatliner_ongoing = validation.detect_ongoing_flatliner(
62
62
  load=input_data.iloc[:, 0],
63
63
  duration_threshold_minutes=pj.flatliner_threshold_minutes,
64
64
  )
65
65
 
66
- if zero_flatliner_ongoing:
66
+ if flatliner_ongoing:
67
67
  # Set historic load to zero to force the basecase forecasts to be zero.
68
68
  input_data.loc[input_data.index < forecast_start, "load"] = 0
69
69
 
@@ -45,7 +45,7 @@ def create_forecast_pipeline(
45
45
  DataFrame with the forecast
46
46
 
47
47
  Raises:
48
- InputDataOngoingZeroFlatlinerError: When all recent load measurements are zero.
48
+ InputDataOngoingFlatlinerError: When all recent load measurements are constant.
49
49
  LookupError: When no model is found for the given prediction job in MLflow.
50
50
 
51
51
  """
@@ -85,7 +85,7 @@ def create_forecast_pipeline_core(
85
85
  Forecast
86
86
 
87
87
  Raises:
88
- InputDataOngoingZeroFlatlinerError: When all recent load measurements are zero.
88
+ InputDataOngoingFlatlinerError: When all recent load measurements are constant.
89
89
 
90
90
  """
91
91
  structlog.configure(
@@ -103,6 +103,7 @@ def create_forecast_pipeline_core(
103
103
  input_data,
104
104
  pj["flatliner_threshold_minutes"],
105
105
  pj["resolution_minutes"],
106
+ detect_non_zero_flatliner=pj["detect_non_zero_flatliner"],
106
107
  )
107
108
 
108
109
  # Custom data prep or legacy behavior
@@ -132,7 +132,7 @@ def optimize_hyperparameters_pipeline_core(
132
132
  InputDataInsufficientError: If the input dataframe is empty.
133
133
  InputDataWrongColumnOrderError: If the load column is missing in the input dataframe.
134
134
  OldModelHigherScoreError: When old model is better than new model.
135
- InputDataOngoingZeroFlatlinerError: When all recent load measurements are zero.
135
+ InputDataOngoingFlatlinerError: If all recent load measurements are constant.
136
136
 
137
137
  Returns:
138
138
  - Best model,
@@ -157,6 +157,7 @@ def optimize_hyperparameters_pipeline_core(
157
157
  input_data,
158
158
  pj["flatliner_threshold_minutes"],
159
159
  pj["resolution_minutes"],
160
+ detect_non_zero_flatliner=pj["detect_non_zero_flatliner"],
160
161
  )
161
162
  )
162
163
 
@@ -60,7 +60,7 @@ def train_model_and_forecast_back_test(
60
60
  InputDataInsufficientError: when input data is insufficient.
61
61
  InputDataWrongColumnOrderError: when input data has a invalid column order.
62
62
  ValueError: when the horizon is a string and the corresponding column in not in the input data
63
- InputDataOngoingZeroFlatlinerError: when all recent load measurements are zero.
63
+ InputDataOngoingFlatlinerError: If all recent load measurements are constant.
64
64
 
65
65
  """
66
66
  if pj.backtest_split_func is None:
@@ -177,7 +177,7 @@ def train_model_pipeline_core(
177
177
  InputDataInsufficientError: when input data is insufficient.
178
178
  InputDataWrongColumnOrderError: when input data has a invalid column order.
179
179
  OldModelHigherScoreError: When old model is better than new model.
180
- InputDataOngoingZeroFlatlinerError: when all recent load measurements are zero.
180
+ InputDataOngoingFlatlinerError: If all recent load measurements are constant.
181
181
 
182
182
  Returns:
183
183
  - Fitted_model (OpenstfRegressor)
@@ -272,7 +272,7 @@ def train_pipeline_common(
272
272
  InputDataInsufficientError: when input data is insufficient.
273
273
  InputDataWrongColumnOrderError: when input data has a invalid column order.
274
274
  'load' column should be first and 'horizon' column last.
275
- InputDataOngoingZeroFlatlinerError: when all recent load measurements are zero.
275
+ InputDataOngoingFlatlinerError: If all recent load measurements are constant.
276
276
 
277
277
  """
278
278
  data_with_features = train_pipeline_step_compute_features(
@@ -363,7 +363,7 @@ def train_pipeline_step_compute_features(
363
363
  InputDataInsufficientError: when input data is insufficient.
364
364
  InputDataWrongColumnOrderError: when input data has a invalid column order.
365
365
  ValueError: when the horizon is a string and the corresponding column in not in the input data
366
- InputDataOngoingZeroFlatlinerError: when all recent load measurements are zero.
366
+ InputDataOngoingFlatlinerError: If all recent load measurements are constant.
367
367
 
368
368
  """
369
369
  if input_data.empty:
@@ -389,6 +389,7 @@ def train_pipeline_step_compute_features(
389
389
  input_data,
390
390
  pj["flatliner_threshold_minutes"],
391
391
  pj["resolution_minutes"],
392
+ detect_non_zero_flatliner=pj["detect_non_zero_flatliner"],
392
393
  )
393
394
  )
394
395
  # Check if sufficient data is left after cleaning
@@ -0,0 +1,3 @@
1
+ # SPDX-FileCopyrightText: 2017-2025 Contributors to the OpenSTEF project <korte.termijn.prognoses@alliander.com> # noqa E501>
2
+ #
3
+ # SPDX-License-Identifier: MPL-2.0
@@ -0,0 +1,216 @@
1
+ # SPDX-FileCopyrightText: 2017-2025 Contributors to the OpenSTEF project <korte.termijn.prognoses@alliander.com> # noqa E501>
2
+ #
3
+ # SPDX-License-Identifier: MPL-2.0
4
+
5
+ from typing import Tuple, Optional
6
+
7
+ import numpy as np
8
+ from pydantic import BaseModel
9
+ import pandas as pd
10
+ import plotly.graph_objects as go
11
+ import plotly.express as px
12
+
13
+
14
+ class LoadForecastPlotter(BaseModel):
15
+ colormap: str = "Blues"
16
+ colormap_range: Tuple[float, float] = (0.2, 0.8)
17
+
18
+ fill_opacity: float = 0.5
19
+ stroke_opacity: float = 0.8
20
+ stroke_width: float = 1.5
21
+
22
+ def _get_color_by_value(self, value: float) -> str:
23
+ """Maps a normalized value to a color using the specified colormap.
24
+
25
+ Args:
26
+ value (float): A value between 0 and 1 to be mapped to a color.
27
+
28
+ Returns:
29
+ str: A color in the rgba format.
30
+ """
31
+ rescaled = self.colormap_range[0] + value * (
32
+ self.colormap_range[1] - self.colormap_range[0]
33
+ )
34
+ rescaled = min(1.0, max(0.0, rescaled))
35
+
36
+ return px.colors.sample_colorscale(
37
+ colorscale=self.colormap, samplepoints=[rescaled]
38
+ )[0]
39
+
40
+ def _get_quantile_colors(self, quantile: float) -> Tuple[str, str]:
41
+ """Generate fill and stroke colors for a given quantile using a colorscale.
42
+
43
+ Colors are determined based on the distance from the median (50th percentile).
44
+
45
+ Args:
46
+ quantile (float): The quantile value (0-100) to generate colors for.
47
+
48
+ Returns:
49
+ Tuple[str, str]: A tuple containing (fill_color, stroke_color).
50
+ """
51
+ fill_value = 1 - abs(quantile - 50.0) / 50.0
52
+ stroke_value = 1 - abs(quantile + 5.0 - 50.0) / 50.0
53
+ return (
54
+ self._get_color_by_value(fill_value),
55
+ self._get_color_by_value(stroke_value),
56
+ )
57
+
58
+ def _add_quantile_band(
59
+ self,
60
+ figure: go.Figure,
61
+ lower_quantile_data: pd.Series,
62
+ lower_quantile: float,
63
+ upper_quantile_data: pd.Series,
64
+ upper_quantile: float,
65
+ ):
66
+ """Add a quantile band to the plotly figure.
67
+
68
+ Creates a filled polygon representing the area between lower and upper quantiles,
69
+ and adds it to the provided figure along with hover information.
70
+
71
+ Args:
72
+ figure (go.Figure): The plotly figure to add the quantile band to.
73
+ lower_quantile_data (pd.Series): Series with data for the lower quantile.
74
+ lower_quantile (float): The percentile value of the lower quantile.
75
+ upper_quantile_data (pd.Series): Series with data for the upper quantile.
76
+ upper_quantile (float): The percentile value of the upper quantile.
77
+
78
+ Returns:
79
+ None: The figure is modified in place.
80
+ """
81
+ # Create polygon shape for the quantile band in counterclockwise order
82
+ x = list(lower_quantile_data.index) + list(upper_quantile_data.index[::-1])
83
+ y = list(lower_quantile_data) + list(upper_quantile_data[::-1])
84
+
85
+ # Get colors for the band
86
+ fill_color, stroke_color = self._get_quantile_colors(lower_quantile)
87
+
88
+ # Group traces by quantile range
89
+ legendgroup = f"quantile_{lower_quantile}_{upper_quantile}"
90
+
91
+ # Add a single trace that forms a filled polygon
92
+ figure.add_trace(
93
+ go.Scatter(
94
+ x=x,
95
+ y=y,
96
+ fill="toself",
97
+ fillcolor=f"rgba{fill_color[3:-1]}, {self.fill_opacity})",
98
+ line=dict(
99
+ color=f"rgba{stroke_color[3:-1]}, {self.stroke_opacity})",
100
+ width=self.stroke_width,
101
+ ),
102
+ name=f"{lower_quantile}%-{upper_quantile}%",
103
+ showlegend=True,
104
+ hoverinfo="skip",
105
+ legendgroup=legendgroup,
106
+ )
107
+ )
108
+
109
+ # Add an (invisible) line around the filled area to make quantile
110
+ # values selectable/hover-able.
111
+ # Hovering on filled area values is not supported by plotly.
112
+ figure.add_trace(
113
+ go.Scatter(
114
+ x=lower_quantile_data.index,
115
+ y=lower_quantile_data.values,
116
+ mode="lines",
117
+ line=dict(
118
+ width=self.stroke_width,
119
+ color=f"rgba{stroke_color[3:-1]}, {self.stroke_opacity})",
120
+ ),
121
+ customdata=np.column_stack(
122
+ (lower_quantile_data.values, upper_quantile_data.values)
123
+ ),
124
+ hovertemplate=(
125
+ f"{lower_quantile}%: %{{customdata[0]:,.4s}}<br>"
126
+ f"{upper_quantile}%: %{{customdata[1]:,.4s}}"
127
+ "<extra></extra>"
128
+ ),
129
+ name=f"{lower_quantile}%-{upper_quantile}% Hover Info",
130
+ showlegend=False,
131
+ legendgroup=legendgroup,
132
+ )
133
+ )
134
+
135
+ def plot(
136
+ self,
137
+ realized: Optional[pd.Series] = None,
138
+ forecast: Optional[pd.Series] = None,
139
+ quantiles: Optional[pd.DataFrame] = None,
140
+ ):
141
+ """Create a plot showing forecast quantiles and realized values.
142
+
143
+ Generates an interactive plotly figure displaying the forecast distribution
144
+ through quantile bands, the median forecast, and the actual realized values.
145
+
146
+ Args:
147
+ realized (pd.Series): Time series of realized (actual) values.
148
+ forecast (pd.Series): Time series of forecast values (typically the median).
149
+ quantiles (pd.DataFrame): DataFrame containing quantile predictions.
150
+ Column names should follow the format 'quantile_P{percentile:02d}',
151
+ e.g., 'quantile_P10', 'quantile_P90'.
152
+
153
+ Returns:
154
+ go.Figure: A plotly figure object with the configured visualization.
155
+ """
156
+ figure = go.Figure()
157
+
158
+ if quantiles is not None:
159
+ # Extract and sort quantile percentages
160
+ quantile_cols = [
161
+ col for col in quantiles.columns if col.startswith("quantile_P")
162
+ ]
163
+ percentiles = sorted([int(col.split("P")[1]) for col in quantile_cols])
164
+
165
+ # Add quantile bands from widest to narrowest
166
+ for i in range(len(percentiles) // 2):
167
+ lower_quantile, upper_quantile = percentiles[i], percentiles[-(i + 1)]
168
+ if float(lower_quantile) == 50.0:
169
+ continue
170
+
171
+ self._add_quantile_band(
172
+ figure=figure,
173
+ lower_quantile_data=quantiles[f"quantile_P{lower_quantile:02d}"],
174
+ lower_quantile=lower_quantile,
175
+ upper_quantile_data=quantiles[f"quantile_P{upper_quantile:02d}"],
176
+ upper_quantile=upper_quantile,
177
+ )
178
+
179
+ if forecast is not None:
180
+ # Add forecast line (50th percentile)
181
+ figure.add_trace(
182
+ go.Scatter(
183
+ x=forecast.index,
184
+ y=forecast,
185
+ mode="lines",
186
+ line=dict(color="blue", width=self.stroke_width),
187
+ name="Forecast (50th)",
188
+ customdata=forecast.values,
189
+ hovertemplate="Forecast (50th): %{customdata:,.4s}<extra></extra>",
190
+ )
191
+ )
192
+
193
+ if realized is not None:
194
+ # Add realized values on top
195
+ figure.add_trace(
196
+ go.Scatter(
197
+ x=realized.index,
198
+ y=realized,
199
+ mode="lines",
200
+ line=dict(color="red", width=self.stroke_width),
201
+ customdata=realized.values,
202
+ hovertemplate="Realized: %{customdata:,.4s}<extra></extra>",
203
+ name="Realized",
204
+ )
205
+ )
206
+
207
+ # Styling configuration
208
+ figure.update_layout(
209
+ title=f"Load Forecast vs Actual",
210
+ xaxis_title="Datetime [UTC]",
211
+ yaxis_title="Load [W]",
212
+ template="plotly_white",
213
+ hovermode="x unified",
214
+ )
215
+
216
+ return figure
@@ -25,11 +25,11 @@ from pathlib import Path
25
25
 
26
26
  from openstef.data_classes.prediction_job import PredictionJobDataClass
27
27
  from openstef.enums import BiddingZone, ModelType, PipelineType
28
- from openstef.exceptions import InputDataOngoingZeroFlatlinerError
28
+ from openstef.exceptions import InputDataOngoingFlatlinerError
29
29
  from openstef.pipeline.create_forecast import create_forecast_pipeline
30
30
  from openstef.tasks.utils.predictionjobloop import PredictionJobLoop
31
31
  from openstef.tasks.utils.taskcontext import TaskContext
32
- from openstef.validation.validation import detect_ongoing_zero_flatliner
32
+ from openstef.validation.validation import detect_ongoing_flatliner
33
33
 
34
34
  T_BEHIND_DAYS: int = 14
35
35
 
@@ -94,7 +94,7 @@ def create_forecast_task(
94
94
  forecast = create_forecast_pipeline(
95
95
  pj, input_data, mlflow_tracking_uri=mlflow_tracking_uri
96
96
  )
97
- except (InputDataOngoingZeroFlatlinerError, LookupError) as e:
97
+ except (InputDataOngoingFlatlinerError, LookupError) as e:
98
98
  if (
99
99
  context.config.known_zero_flatliners
100
100
  and pj.id in context.config.known_zero_flatliners
@@ -103,18 +103,18 @@ def create_forecast_task(
103
103
  "No forecasts were made for this known zero flatliner prediction job. No forecasts need to be made either, since the fallback forecasts are sufficient."
104
104
  )
105
105
  return
106
- elif isinstance(e, InputDataOngoingZeroFlatlinerError):
107
- raise InputDataOngoingZeroFlatlinerError(
108
- 'All recent load measurements are zero. Check the load profile of this pid as well as related/neighbouring prediction jobs. Afterwards, consider adding this pid to the "known_zero_flatliners" app_setting and possibly removing other pids from the same app_setting.'
106
+ elif isinstance(e, InputDataOngoingFlatlinerError):
107
+ raise InputDataOngoingFlatlinerError(
108
+ 'All recent load measurements are constant. Check the load profile of this pid as well as related/neighbouring prediction jobs. Afterwards, consider adding this pid to the "known_zero_flatliners" app_setting and possibly removing other pids from the same app_setting.'
109
109
  ) from e
110
110
  elif isinstance(e, LookupError):
111
- zero_flatliner_ongoing = detect_ongoing_zero_flatliner(
111
+ zero_flatliner_ongoing = detect_ongoing_flatliner(
112
112
  load=input_data.iloc[:, 0],
113
113
  duration_threshold_minutes=pj.flatliner_threshold_minutes,
114
114
  )
115
115
  if zero_flatliner_ongoing:
116
116
  raise LookupError(
117
- 'Model not found. Consider checking for a zero flatliner and adding this pid to the "known_zero_flatliners" app_setting. For zero flatliners, no model can be trained.'
117
+ 'Model not found. Consider checking for a flatliner and adding this pid to the "known_zero_flatliners" app_setting. For flatliners, no model can be trained.'
118
118
  ) from e
119
119
  else:
120
120
  raise e