openstef 3.4.16__tar.gz → 3.4.30__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.
- {openstef-3.4.16 → openstef-3.4.30}/PKG-INFO +30 -35
- {openstef-3.4.16 → openstef-3.4.30}/README.md +28 -34
- openstef-3.4.30/openstef/app_settings.py +19 -0
- {openstef-3.4.16 → openstef-3.4.30}/openstef/data_classes/prediction_job.py +5 -0
- {openstef-3.4.16 → openstef-3.4.30}/openstef/enums.py +3 -0
- {openstef-3.4.16 → openstef-3.4.30}/openstef/exceptions.py +1 -1
- {openstef-3.4.16 → openstef-3.4.30}/openstef/feature_engineering/data_preparation.py +7 -0
- {openstef-3.4.16 → openstef-3.4.30}/openstef/feature_engineering/general.py +14 -0
- openstef-3.4.30/openstef/feature_engineering/missing_values_transformer.py +99 -0
- {openstef-3.4.16 → openstef-3.4.30}/openstef/feature_engineering/weather_features.py +7 -0
- {openstef-3.4.16 → openstef-3.4.30}/openstef/metrics/metrics.py +51 -0
- {openstef-3.4.16 → openstef-3.4.30}/openstef/metrics/reporter.py +7 -0
- {openstef-3.4.16 → openstef-3.4.30}/openstef/model/confidence_interval_applicator.py +25 -3
- {openstef-3.4.16 → openstef-3.4.30}/openstef/model/model_creator.py +36 -0
- {openstef-3.4.16 → openstef-3.4.30}/openstef/model/objective.py +30 -0
- {openstef-3.4.16 → openstef-3.4.30}/openstef/model/objective_creator.py +3 -0
- openstef-3.4.30/openstef/model/regressors/dazls.py +116 -0
- openstef-3.4.30/openstef/model/regressors/flatliner.py +100 -0
- openstef-3.4.30/openstef/model/regressors/linear_quantile.py +247 -0
- openstef-3.4.30/openstef/model/regressors/xgb_multioutput_quantile.py +261 -0
- {openstef-3.4.16 → openstef-3.4.30}/openstef/model/serializer.py +7 -0
- {openstef-3.4.16 → openstef-3.4.30}/openstef/model_selection/model_selection.py +1 -1
- {openstef-3.4.16 → openstef-3.4.30}/openstef/monitoring/teams.py +11 -0
- {openstef-3.4.16 → openstef-3.4.30}/openstef/pipeline/create_basecase_forecast.py +7 -0
- {openstef-3.4.16 → openstef-3.4.30}/openstef/pipeline/create_component_forecast.py +10 -20
- {openstef-3.4.16 → openstef-3.4.30}/openstef/pipeline/create_forecast.py +12 -0
- {openstef-3.4.16 → openstef-3.4.30}/openstef/pipeline/optimize_hyperparameters.py +9 -2
- {openstef-3.4.16 → openstef-3.4.30}/openstef/pipeline/train_create_forecast_backtest.py +2 -0
- {openstef-3.4.16 → openstef-3.4.30}/openstef/pipeline/train_model.py +15 -7
- {openstef-3.4.16 → openstef-3.4.30}/openstef/postprocessing/postprocessing.py +29 -0
- openstef-3.4.30/openstef/settings.py +15 -0
- {openstef-3.4.16 → openstef-3.4.30}/openstef/tasks/calculate_kpi.py +20 -10
- {openstef-3.4.16 → openstef-3.4.30}/openstef/tasks/create_basecase_forecast.py +13 -5
- {openstef-3.4.16 → openstef-3.4.30}/openstef/tasks/create_components_forecast.py +15 -3
- {openstef-3.4.16 → openstef-3.4.30}/openstef/tasks/create_forecast.py +5 -2
- {openstef-3.4.16 → openstef-3.4.30}/openstef/tasks/split_forecast.py +7 -0
- {openstef-3.4.16 → openstef-3.4.30}/openstef/tasks/utils/taskcontext.py +7 -0
- {openstef-3.4.16 → openstef-3.4.30}/openstef/validation/validation.py +22 -0
- {openstef-3.4.16 → openstef-3.4.30}/openstef.egg-info/PKG-INFO +30 -35
- {openstef-3.4.16 → openstef-3.4.30}/openstef.egg-info/SOURCES.txt +6 -18
- {openstef-3.4.16 → openstef-3.4.30}/openstef.egg-info/requires.txt +1 -0
- {openstef-3.4.16 → openstef-3.4.30}/setup.py +1 -1
- openstef-3.4.16/openstef/data/dazls_model_3.4.7/dazls_stored_3.4.7_adaptation_model.z +0 -0
- openstef-3.4.16/openstef/data/dazls_model_3.4.7/dazls_stored_3.4.7_adaptation_model.z.license +0 -3
- openstef-3.4.16/openstef/data/dazls_model_3.4.7/dazls_stored_3.4.7_adaptation_model_features.z +0 -0
- openstef-3.4.16/openstef/data/dazls_model_3.4.7/dazls_stored_3.4.7_adaptation_model_features.z.license +0 -3
- openstef-3.4.16/openstef/data/dazls_model_3.4.7/dazls_stored_3.4.7_adaptation_model_scaler.z +0 -0
- openstef-3.4.16/openstef/data/dazls_model_3.4.7/dazls_stored_3.4.7_adaptation_model_scaler.z.license +0 -3
- openstef-3.4.16/openstef/data/dazls_model_3.4.7/dazls_stored_3.4.7_domain_model.z +0 -0
- openstef-3.4.16/openstef/data/dazls_model_3.4.7/dazls_stored_3.4.7_domain_model.z.license +0 -3
- openstef-3.4.16/openstef/data/dazls_model_3.4.7/dazls_stored_3.4.7_domain_model_features.z +0 -2
- openstef-3.4.16/openstef/data/dazls_model_3.4.7/dazls_stored_3.4.7_domain_model_features.z.license +0 -3
- openstef-3.4.16/openstef/data/dazls_model_3.4.7/dazls_stored_3.4.7_domain_model_scaler.z +0 -0
- openstef-3.4.16/openstef/data/dazls_model_3.4.7/dazls_stored_3.4.7_domain_model_scaler.z.license +0 -3
- openstef-3.4.16/openstef/data/dazls_model_3.4.7/dazls_stored_3.4.7_model_card.md +0 -14
- openstef-3.4.16/openstef/data/dazls_model_3.4.7/dazls_stored_3.4.7_model_card.md.license +0 -3
- openstef-3.4.16/openstef/data/dazls_model_3.4.7/dazls_stored_3.4.7_target.z +0 -0
- openstef-3.4.16/openstef/data/dazls_model_3.4.7/dazls_stored_3.4.7_target.z.license +0 -3
- openstef-3.4.16/openstef/data/dazls_model_3.4.7/dazls_stored_3.4.7_target_scaler.z +0 -0
- openstef-3.4.16/openstef/data/dazls_model_3.4.7/dazls_stored_3.4.7_target_scaler.z.license +0 -3
- openstef-3.4.16/openstef/model/regressors/dazls.py +0 -191
- {openstef-3.4.16 → openstef-3.4.30}/LICENSE +0 -0
- {openstef-3.4.16 → openstef-3.4.30}/openstef/__init__.py +0 -0
- {openstef-3.4.16 → openstef-3.4.30}/openstef/__main__.py +0 -0
- {openstef-3.4.16 → openstef-3.4.30}/openstef/data/dutch_holidays_2020-2022.csv +0 -0
- {openstef-3.4.16 → openstef-3.4.30}/openstef/data/dutch_holidays_2020-2022.csv.license +0 -0
- {openstef-3.4.16 → openstef-3.4.30}/openstef/data/pv_single_coefs.csv +0 -0
- {openstef-3.4.16 → openstef-3.4.30}/openstef/data/pv_single_coefs.csv.license +0 -0
- {openstef-3.4.16 → openstef-3.4.30}/openstef/data_classes/__init__.py +0 -0
- {openstef-3.4.16 → openstef-3.4.30}/openstef/data_classes/data_prep.py +0 -0
- {openstef-3.4.16 → openstef-3.4.30}/openstef/data_classes/model_specifications.py +0 -0
- {openstef-3.4.16 → openstef-3.4.30}/openstef/data_classes/split_function.py +0 -0
- {openstef-3.4.16 → openstef-3.4.30}/openstef/feature_engineering/__init__.py +0 -0
- {openstef-3.4.16 → openstef-3.4.30}/openstef/feature_engineering/apply_features.py +0 -0
- {openstef-3.4.16 → openstef-3.4.30}/openstef/feature_engineering/feature_adder.py +0 -0
- {openstef-3.4.16 → openstef-3.4.30}/openstef/feature_engineering/feature_applicator.py +0 -0
- {openstef-3.4.16 → openstef-3.4.30}/openstef/feature_engineering/holiday_features.py +0 -0
- {openstef-3.4.16 → openstef-3.4.30}/openstef/feature_engineering/lag_features.py +0 -0
- {openstef-3.4.16 → openstef-3.4.30}/openstef/metrics/__init__.py +0 -0
- {openstef-3.4.16 → openstef-3.4.30}/openstef/metrics/figure.py +0 -0
- {openstef-3.4.16 → openstef-3.4.30}/openstef/model/__init__.py +0 -0
- {openstef-3.4.16 → openstef-3.4.30}/openstef/model/basecase.py +0 -0
- {openstef-3.4.16 → openstef-3.4.30}/openstef/model/fallback.py +0 -0
- {openstef-3.4.16 → openstef-3.4.30}/openstef/model/metamodels/__init__.py +0 -0
- {openstef-3.4.16 → openstef-3.4.30}/openstef/model/metamodels/grouped_regressor.py +0 -0
- {openstef-3.4.16 → openstef-3.4.30}/openstef/model/metamodels/missing_values_handler.py +0 -0
- {openstef-3.4.16 → openstef-3.4.30}/openstef/model/regressors/__init__.py +0 -0
- {openstef-3.4.16 → openstef-3.4.30}/openstef/model/regressors/arima.py +0 -0
- {openstef-3.4.16 → openstef-3.4.30}/openstef/model/regressors/custom_regressor.py +0 -0
- {openstef-3.4.16 → openstef-3.4.30}/openstef/model/regressors/lgbm.py +0 -0
- {openstef-3.4.16 → openstef-3.4.30}/openstef/model/regressors/linear.py +0 -0
- {openstef-3.4.16 → openstef-3.4.30}/openstef/model/regressors/regressor.py +0 -0
- {openstef-3.4.16 → openstef-3.4.30}/openstef/model/regressors/xgb.py +0 -0
- {openstef-3.4.16 → openstef-3.4.30}/openstef/model/regressors/xgb_quantile.py +0 -0
- {openstef-3.4.16 → openstef-3.4.30}/openstef/model/standard_deviation_generator.py +0 -0
- {openstef-3.4.16 → openstef-3.4.30}/openstef/model_selection/__init__.py +0 -0
- {openstef-3.4.16 → openstef-3.4.30}/openstef/monitoring/__init__.py +0 -0
- {openstef-3.4.16 → openstef-3.4.30}/openstef/monitoring/performance_meter.py +0 -0
- {openstef-3.4.16 → openstef-3.4.30}/openstef/pipeline/__init__.py +0 -0
- {openstef-3.4.16 → openstef-3.4.30}/openstef/pipeline/utils.py +0 -0
- {openstef-3.4.16 → openstef-3.4.30}/openstef/postprocessing/__init__.py +0 -0
- {openstef-3.4.16 → openstef-3.4.30}/openstef/preprocessing/__init__.py +0 -0
- {openstef-3.4.16 → openstef-3.4.30}/openstef/preprocessing/preprocessing.py +0 -0
- {openstef-3.4.16 → openstef-3.4.30}/openstef/tasks/__init__.py +0 -0
- {openstef-3.4.16 → openstef-3.4.30}/openstef/tasks/create_solar_forecast.py +0 -0
- {openstef-3.4.16 → openstef-3.4.30}/openstef/tasks/create_wind_forecast.py +0 -0
- {openstef-3.4.16 → openstef-3.4.30}/openstef/tasks/optimize_hyperparameters.py +0 -0
- {openstef-3.4.16 → openstef-3.4.30}/openstef/tasks/train_model.py +0 -0
- {openstef-3.4.16 → openstef-3.4.30}/openstef/tasks/utils/__init__.py +0 -0
- {openstef-3.4.16 → openstef-3.4.30}/openstef/tasks/utils/dependencies.py +0 -0
- {openstef-3.4.16 → openstef-3.4.30}/openstef/tasks/utils/predictionjobloop.py +0 -0
- {openstef-3.4.16 → openstef-3.4.30}/openstef/validation/__init__.py +0 -0
- {openstef-3.4.16 → openstef-3.4.30}/openstef.egg-info/dependency_links.txt +0 -0
- {openstef-3.4.16 → openstef-3.4.30}/openstef.egg-info/top_level.txt +0 -0
- {openstef-3.4.16 → openstef-3.4.30}/pyproject.toml +0 -0
- {openstef-3.4.16 → openstef-3.4.30}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: openstef
|
3
|
-
Version: 3.4.
|
3
|
+
Version: 3.4.30
|
4
4
|
Summary: Open short term energy forecaster
|
5
5
|
Home-page: https://github.com/OpenSTEF/openstef
|
6
6
|
Author: Alliander N.V
|
@@ -27,6 +27,7 @@ Requires-Dist: pandas~=2.2.0
|
|
27
27
|
Requires-Dist: plotly~=5.18
|
28
28
|
Requires-Dist: pvlib==0.9.4
|
29
29
|
Requires-Dist: pydantic~=2.4
|
30
|
+
Requires-Dist: pydantic-settings~=2.3
|
30
31
|
Requires-Dist: pymsteams~=0.2.2
|
31
32
|
Requires-Dist: scikit-learn~=1.3
|
32
33
|
Requires-Dist: scipy~=1.10
|
@@ -40,9 +41,11 @@ SPDX-FileCopyrightText: 2017-2023 Contributors to the OpenSTEF project <korte.te
|
|
40
41
|
SPDX-License-Identifier: MPL-2.0
|
41
42
|
-->
|
42
43
|
|
43
|
-
|
44
|
-
|
45
|
-
[](https://pepy.tech/project/openstef)
|
47
|
+
[](https://pepy.tech/project/openstef)
|
48
|
+
[](https://bestpractices.coreinfrastructure.org/projects/5585)
|
46
49
|
<!-- SonarCloud badges -->
|
47
50
|
[](https://sonarcloud.io/dashboard?id=OpenSTEF_openstef)
|
48
51
|
[](https://sonarcloud.io/dashboard?id=OpenSTEF_openstef)
|
@@ -53,11 +56,6 @@ SPDX-License-Identifier: MPL-2.0
|
|
53
56
|
[](https://sonarcloud.io/dashboard?id=OpenSTEF_openstef)
|
54
57
|
[](https://sonarcloud.io/dashboard?id=OpenSTEF_openstef)
|
55
58
|
[](https://sonarcloud.io/dashboard?id=OpenSTEF_openstef)
|
56
|
-
[](https://bestpractices.coreinfrastructure.org/projects/5585)
|
57
|
-
[](https://pepy.tech/project/openstef)
|
58
|
-
[](https://pepy.tech/project/openstef)
|
59
|
-
|
60
|
-
# OpenSTEF
|
61
59
|
|
62
60
|
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.
|
63
61
|
|
@@ -65,26 +63,22 @@ OpenSTEF is a Python package designed for generating short-term forecasts in the
|
|
65
63
|
- [OpenSTEF](#openstef)
|
66
64
|
- [Table of contents](#table-of-contents)
|
67
65
|
- [External information sources](#external-information-sources)
|
68
|
-
- [Installation](#
|
69
|
-
- [Install the openstef package](#install-the-openstef-package)
|
70
|
-
- [Remark regarding installation within a **conda environment on Windows**:](#remark-regarding-installation-within-a-conda-environment-on-windows)
|
66
|
+
- [Installation](#install)
|
71
67
|
- [Usage](#usage)
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
- [Contact](#contact)
|
68
|
+
- [Example notebooks](#example-notebooks)
|
69
|
+
- [Reference Implementation](#reference-implementation)
|
70
|
+
- [Database connector for OpenSTEF](#database-connector-for-openstef)
|
71
|
+
- [License](license)
|
72
|
+
- [Contributing](#contributing)
|
73
|
+
- [Contact](#contact)
|
79
74
|
|
80
75
|
# External information sources
|
81
76
|
- [Documentation website](https://openstef.github.io/openstef/index.html);
|
82
77
|
- [Python package](https://pypi.org/project/openstef/);
|
83
|
-
- [
|
78
|
+
- [Linux Foundation project page](https://www.lfenergy.org/projects/openstef/);
|
84
79
|
- [Documentation on dashboard](https://raw.githack.com/OpenSTEF/.github/main/profile/html/openstef_dashboard_doc.html);
|
85
|
-
- [Linux Foundation project page](https://openstef.github.io/openstef/index.html)
|
86
80
|
- [Video about OpenSTEF](https://www.lfenergy.org/forecasting-to-create-a-more-resilient-optimized-grid/);
|
87
|
-
- [Teams channel](https://teams.microsoft.com/l/team/19%3ac08a513650524fc988afb296cd0358cc%40thread.tacv2/conversations?groupId=bfcb763a-3a97-4938-81d7-b14512aa537d&tenantId=697f104b-d7cb-48c8-ac9f-bd87105bafdc)
|
81
|
+
- [Teams channel](https://teams.microsoft.com/l/team/19%3ac08a513650524fc988afb296cd0358cc%40thread.tacv2/conversations?groupId=bfcb763a-3a97-4938-81d7-b14512aa537d&tenantId=697f104b-d7cb-48c8-ac9f-bd87105bafdc)
|
88
82
|
|
89
83
|
# Installation
|
90
84
|
|
@@ -104,33 +98,34 @@ For more information on this issue see the [readme of pywin32](https://github.co
|
|
104
98
|
|
105
99
|
# Usage
|
106
100
|
|
107
|
-
|
108
|
-
|
109
|
-
```shell
|
110
|
-
python -m openstef task <task_name>
|
111
|
-
```
|
101
|
+
## Example notebooks
|
102
|
+
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).
|
112
103
|
|
113
104
|
## Reference Implementation
|
114
105
|
A complete implementation including databases, user interface, example data, etc. is available at: https://github.com/OpenSTEF/openstef-reference
|
115
106
|
|
116
107
|

|
117
108
|
Screenshot of the operational dashboard showing the key functionality of OpenSTEF.
|
118
|
-
Dashboard documentation can be found [here](https://
|
109
|
+
Dashboard documentation can be found [here](https://raw.githack.com/OpenSTEF/.github/main/profile/html/openstef_dashboard_doc.html).
|
119
110
|
|
120
|
-
|
121
|
-
This repository provides an interface to OpenSTEF (reference) databases. The repository can be found [here](https://github.com/OpenSTEF/openstef-dbc).
|
111
|
+
To run a task use:
|
122
112
|
|
123
|
-
|
124
|
-
|
113
|
+
```shell
|
114
|
+
python -m openstef task <task_name>
|
115
|
+
```
|
116
|
+
|
117
|
+
## Database connector for openstef
|
118
|
+
This repository provides an interface to OpenSTEF (reference) databases. The repository can be found [here](https://github.com/OpenSTEF/openstef-dbc).
|
125
119
|
|
126
|
-
|
120
|
+
# License
|
127
121
|
This project is licensed under the Mozilla Public License, version 2.0 - see LICENSE for details.
|
128
122
|
|
129
123
|
## Licenses third-party libraries
|
130
124
|
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.
|
131
125
|
|
132
|
-
|
126
|
+
# Contributing
|
133
127
|
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.
|
134
128
|
|
135
|
-
|
129
|
+
# Contact
|
136
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
|
131
|
+
|
@@ -4,9 +4,11 @@ SPDX-FileCopyrightText: 2017-2023 Contributors to the OpenSTEF project <korte.te
|
|
4
4
|
SPDX-License-Identifier: MPL-2.0
|
5
5
|
-->
|
6
6
|
|
7
|
-
|
8
|
-
|
9
|
-
[](https://pepy.tech/project/openstef)
|
10
|
+
[](https://pepy.tech/project/openstef)
|
11
|
+
[](https://bestpractices.coreinfrastructure.org/projects/5585)
|
10
12
|
<!-- SonarCloud badges -->
|
11
13
|
[](https://sonarcloud.io/dashboard?id=OpenSTEF_openstef)
|
12
14
|
[](https://sonarcloud.io/dashboard?id=OpenSTEF_openstef)
|
@@ -17,11 +19,6 @@ SPDX-License-Identifier: MPL-2.0
|
|
17
19
|
[](https://sonarcloud.io/dashboard?id=OpenSTEF_openstef)
|
18
20
|
[](https://sonarcloud.io/dashboard?id=OpenSTEF_openstef)
|
19
21
|
[](https://sonarcloud.io/dashboard?id=OpenSTEF_openstef)
|
20
|
-
[](https://bestpractices.coreinfrastructure.org/projects/5585)
|
21
|
-
[](https://pepy.tech/project/openstef)
|
22
|
-
[](https://pepy.tech/project/openstef)
|
23
|
-
|
24
|
-
# OpenSTEF
|
25
22
|
|
26
23
|
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.
|
27
24
|
|
@@ -29,26 +26,22 @@ OpenSTEF is a Python package designed for generating short-term forecasts in the
|
|
29
26
|
- [OpenSTEF](#openstef)
|
30
27
|
- [Table of contents](#table-of-contents)
|
31
28
|
- [External information sources](#external-information-sources)
|
32
|
-
- [Installation](#
|
33
|
-
- [Install the openstef package](#install-the-openstef-package)
|
34
|
-
- [Remark regarding installation within a **conda environment on Windows**:](#remark-regarding-installation-within-a-conda-environment-on-windows)
|
29
|
+
- [Installation](#install)
|
35
30
|
- [Usage](#usage)
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
- [Contact](#contact)
|
31
|
+
- [Example notebooks](#example-notebooks)
|
32
|
+
- [Reference Implementation](#reference-implementation)
|
33
|
+
- [Database connector for OpenSTEF](#database-connector-for-openstef)
|
34
|
+
- [License](license)
|
35
|
+
- [Contributing](#contributing)
|
36
|
+
- [Contact](#contact)
|
43
37
|
|
44
38
|
# External information sources
|
45
39
|
- [Documentation website](https://openstef.github.io/openstef/index.html);
|
46
40
|
- [Python package](https://pypi.org/project/openstef/);
|
47
|
-
- [
|
41
|
+
- [Linux Foundation project page](https://www.lfenergy.org/projects/openstef/);
|
48
42
|
- [Documentation on dashboard](https://raw.githack.com/OpenSTEF/.github/main/profile/html/openstef_dashboard_doc.html);
|
49
|
-
- [Linux Foundation project page](https://openstef.github.io/openstef/index.html)
|
50
43
|
- [Video about OpenSTEF](https://www.lfenergy.org/forecasting-to-create-a-more-resilient-optimized-grid/);
|
51
|
-
- [Teams channel](https://teams.microsoft.com/l/team/19%3ac08a513650524fc988afb296cd0358cc%40thread.tacv2/conversations?groupId=bfcb763a-3a97-4938-81d7-b14512aa537d&tenantId=697f104b-d7cb-48c8-ac9f-bd87105bafdc)
|
44
|
+
- [Teams channel](https://teams.microsoft.com/l/team/19%3ac08a513650524fc988afb296cd0358cc%40thread.tacv2/conversations?groupId=bfcb763a-3a97-4938-81d7-b14512aa537d&tenantId=697f104b-d7cb-48c8-ac9f-bd87105bafdc)
|
52
45
|
|
53
46
|
# Installation
|
54
47
|
|
@@ -68,33 +61,34 @@ For more information on this issue see the [readme of pywin32](https://github.co
|
|
68
61
|
|
69
62
|
# Usage
|
70
63
|
|
71
|
-
|
72
|
-
|
73
|
-
```shell
|
74
|
-
python -m openstef task <task_name>
|
75
|
-
```
|
64
|
+
## Example notebooks
|
65
|
+
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).
|
76
66
|
|
77
67
|
## Reference Implementation
|
78
68
|
A complete implementation including databases, user interface, example data, etc. is available at: https://github.com/OpenSTEF/openstef-reference
|
79
69
|
|
80
70
|

|
81
71
|
Screenshot of the operational dashboard showing the key functionality of OpenSTEF.
|
82
|
-
Dashboard documentation can be found [here](https://
|
72
|
+
Dashboard documentation can be found [here](https://raw.githack.com/OpenSTEF/.github/main/profile/html/openstef_dashboard_doc.html).
|
83
73
|
|
84
|
-
|
85
|
-
This repository provides an interface to OpenSTEF (reference) databases. The repository can be found [here](https://github.com/OpenSTEF/openstef-dbc).
|
74
|
+
To run a task use:
|
86
75
|
|
87
|
-
|
88
|
-
|
76
|
+
```shell
|
77
|
+
python -m openstef task <task_name>
|
78
|
+
```
|
79
|
+
|
80
|
+
## Database connector for openstef
|
81
|
+
This repository provides an interface to OpenSTEF (reference) databases. The repository can be found [here](https://github.com/OpenSTEF/openstef-dbc).
|
89
82
|
|
90
|
-
|
83
|
+
# License
|
91
84
|
This project is licensed under the Mozilla Public License, version 2.0 - see LICENSE for details.
|
92
85
|
|
93
86
|
## Licenses third-party libraries
|
94
87
|
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.
|
95
88
|
|
96
|
-
|
89
|
+
# Contributing
|
97
90
|
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.
|
98
91
|
|
99
|
-
|
92
|
+
# Contact
|
100
93
|
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
|
94
|
+
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# SPDX-FileCopyrightText: 2017-2023 Contributors to the OpenSTEF project <korte.termijn.prognoses@alliander.com> # noqa E501>
|
2
|
+
#
|
3
|
+
# SPDX-License-Identifier: MPL-2.0
|
4
|
+
|
5
|
+
from pydantic import Field
|
6
|
+
from pydantic_settings import BaseSettings, SettingsConfigDict
|
7
|
+
|
8
|
+
|
9
|
+
class AppSettings(BaseSettings):
|
10
|
+
"""Global app settings."""
|
11
|
+
|
12
|
+
model_config = SettingsConfigDict(
|
13
|
+
env_prefix="openstef_", env_file=".env", extra="ignore"
|
14
|
+
)
|
15
|
+
|
16
|
+
post_teams_messages: bool = True
|
17
|
+
|
18
|
+
# Logging settings.
|
19
|
+
log_level: str = Field("INFO", description="Log level used for logging statements.")
|
@@ -25,10 +25,15 @@ class PredictionJobDataClass(BaseModel):
|
|
25
25
|
- ``"xgb_quantile"``
|
26
26
|
- ``"lgb"``
|
27
27
|
- ``"linear"``
|
28
|
+
- ``"linear_quantile"``
|
29
|
+
- ``"xgb_multioutput_quantile"``
|
30
|
+
- ``"flatliner"``
|
28
31
|
|
29
32
|
If unsure what to pick, choose ``"xgb"``.
|
30
33
|
|
31
34
|
"""
|
35
|
+
model_kwargs: Optional[dict]
|
36
|
+
"""The model parameters that should be used."""
|
32
37
|
forecast_type: str
|
33
38
|
"""The type of forecasts that should be made.
|
34
39
|
|
@@ -8,9 +8,12 @@ from enum import Enum
|
|
8
8
|
class MLModelType(Enum):
|
9
9
|
XGB = "xgb"
|
10
10
|
XGB_QUANTILE = "xgb_quantile"
|
11
|
+
XGB_MULTIOUTPUT_QUANTILE = "xgb_multioutput_quantile"
|
11
12
|
LGB = "lgb"
|
12
13
|
LINEAR = "linear"
|
14
|
+
LINEAR_QUANTILE = "linear_quantile"
|
13
15
|
ARIMA = "arima"
|
16
|
+
FLATLINER = "flatliner"
|
14
17
|
|
15
18
|
|
16
19
|
class ForecastType(Enum):
|
@@ -1,6 +1,7 @@
|
|
1
1
|
# SPDX-FileCopyrightText: 2017-2023 Alliander N.V. <korte.termijn.prognoses@alliander.com> # noqa E501>
|
2
2
|
#
|
3
3
|
# SPDX-License-Identifier: MPL-2.0
|
4
|
+
import logging
|
4
5
|
from abc import ABC, abstractmethod
|
5
6
|
from datetime import timedelta
|
6
7
|
from typing import Optional
|
@@ -20,6 +21,7 @@ from openstef.feature_engineering.general import (
|
|
20
21
|
)
|
21
22
|
from openstef.model.regressors.regressor import OpenstfRegressor
|
22
23
|
from openstef.pipeline.utils import generate_forecast_datetime_range
|
24
|
+
from openstef.settings import Settings
|
23
25
|
|
24
26
|
|
25
27
|
class AbstractDataPreparation(ABC):
|
@@ -120,6 +122,11 @@ class ARDataPreparation(AbstractDataPreparation):
|
|
120
122
|
def prepare_forecast_data(
|
121
123
|
self, data: pd.DataFrame
|
122
124
|
) -> tuple[pd.DataFrame, pd.DataFrame]:
|
125
|
+
structlog.configure(
|
126
|
+
wrapper_class=structlog.make_filtering_bound_logger(
|
127
|
+
logging.getLevelName(Settings.log_level)
|
128
|
+
)
|
129
|
+
)
|
123
130
|
logger = structlog.get_logger(__name__)
|
124
131
|
self.check_model()
|
125
132
|
# Prep forecast input by selecting only the forecast datetime interval (this is much smaller than the input range)
|
@@ -3,10 +3,14 @@
|
|
3
3
|
# SPDX-License-Identifier: MPL-2.0
|
4
4
|
"""This modelu contains various helper functions."""
|
5
5
|
|
6
|
+
import logging
|
7
|
+
|
6
8
|
import numpy as np
|
7
9
|
import pandas as pd
|
8
10
|
import structlog
|
9
11
|
|
12
|
+
from openstef.settings import Settings
|
13
|
+
|
10
14
|
|
11
15
|
def add_missing_feature_columns(
|
12
16
|
input_data: pd.DataFrame, features: list[str]
|
@@ -30,6 +34,11 @@ def add_missing_feature_columns(
|
|
30
34
|
Input dataframe with missing columns filled with ``np.N=nan``.
|
31
35
|
|
32
36
|
"""
|
37
|
+
structlog.configure(
|
38
|
+
wrapper_class=structlog.make_filtering_bound_logger(
|
39
|
+
logging.getLevelName(Settings.log_level)
|
40
|
+
)
|
41
|
+
)
|
33
42
|
logger = structlog.get_logger(__name__)
|
34
43
|
|
35
44
|
if features is None:
|
@@ -61,6 +70,11 @@ def remove_non_requested_feature_columns(
|
|
61
70
|
Model input data with features.
|
62
71
|
|
63
72
|
"""
|
73
|
+
structlog.configure(
|
74
|
+
wrapper_class=structlog.make_filtering_bound_logger(
|
75
|
+
logging.getLevelName(Settings.log_level)
|
76
|
+
)
|
77
|
+
)
|
64
78
|
logger = structlog.get_logger(__name__)
|
65
79
|
|
66
80
|
if requested_features is None:
|
@@ -0,0 +1,99 @@
|
|
1
|
+
# SPDX-FileCopyrightText: 2017-2023 Contributors to the OpenSTEF project <korte.termijn.prognoses@alliander.com> # noqa E501>
|
2
|
+
#
|
3
|
+
# SPDX-License-Identifier: MPL-2.0
|
4
|
+
from typing import Union, List, Optional
|
5
|
+
|
6
|
+
import numpy as np
|
7
|
+
import pandas as pd
|
8
|
+
from sklearn.impute import SimpleImputer
|
9
|
+
from sklearn.preprocessing import FunctionTransformer
|
10
|
+
from sklearn.utils.validation import check_array
|
11
|
+
|
12
|
+
|
13
|
+
class MissingValuesTransformer:
|
14
|
+
"""MissingValuesTransformer handles missing values in data by imputing them with a given strategy.
|
15
|
+
|
16
|
+
It also removes columns that are always null from the data.
|
17
|
+
|
18
|
+
"""
|
19
|
+
|
20
|
+
in_feature_names: Optional[List[str]] = None
|
21
|
+
_n_in_features: Optional[int] = None
|
22
|
+
|
23
|
+
non_null_feature_names: List[str] = None
|
24
|
+
|
25
|
+
def __init__(
|
26
|
+
self,
|
27
|
+
missing_values: Union[int, float, str, None] = np.nan,
|
28
|
+
imputation_strategy: str = None,
|
29
|
+
fill_value: Union[str, int, float] = None,
|
30
|
+
):
|
31
|
+
"""Initialize missing values handler.
|
32
|
+
|
33
|
+
Args:
|
34
|
+
missing_values: The placeholder for the missing values. All occurrences of
|
35
|
+
`missing_values` will be imputed.
|
36
|
+
imputation_strategy: The imputation strategy to use
|
37
|
+
Can be one of "mean", "median", "most_frequent", "constant" or None.
|
38
|
+
fill_value: When strategy == "constant", fill_value is used to replace all
|
39
|
+
occurrences of missing_values.
|
40
|
+
|
41
|
+
"""
|
42
|
+
self.missing_values = missing_values
|
43
|
+
self.imputation_strategy = imputation_strategy
|
44
|
+
self.fill_value = fill_value
|
45
|
+
|
46
|
+
def fit(self, x, y=None):
|
47
|
+
"""Fit the imputer on the input data."""
|
48
|
+
_ = check_array(x, force_all_finite="allow-nan")
|
49
|
+
if not isinstance(x, pd.DataFrame):
|
50
|
+
x = pd.DataFrame(np.asarray(x))
|
51
|
+
|
52
|
+
self.in_feature_names = list(x.columns)
|
53
|
+
self._n_in_features = x.shape[1]
|
54
|
+
|
55
|
+
# Remove always null columns
|
56
|
+
is_column_null = x.isnull().all(axis="index")
|
57
|
+
self.non_null_feature_names = list(x.columns[~is_column_null])
|
58
|
+
|
59
|
+
# Build the proper imputation transformer
|
60
|
+
# - Identity function if strategy is None
|
61
|
+
# - SimpleImputer with the dedicated strategy
|
62
|
+
if self.imputation_strategy is None:
|
63
|
+
self.imputer_ = FunctionTransformer(func=self._identity)
|
64
|
+
else:
|
65
|
+
self.imputer_ = SimpleImputer(
|
66
|
+
missing_values=self.missing_values,
|
67
|
+
strategy=self.imputation_strategy,
|
68
|
+
fill_value=self.fill_value,
|
69
|
+
).set_output(transform="pandas")
|
70
|
+
|
71
|
+
# Imputers do not support labels
|
72
|
+
self.imputer_.fit(X=x, y=None)
|
73
|
+
|
74
|
+
def transform(self, x) -> pd.DataFrame:
|
75
|
+
"""Transform the input data by imputing missing values."""
|
76
|
+
_ = check_array(x, force_all_finite="allow-nan")
|
77
|
+
if not isinstance(x, pd.DataFrame):
|
78
|
+
x = pd.DataFrame(np.asarray(x))
|
79
|
+
|
80
|
+
x = x[self.non_null_feature_names]
|
81
|
+
|
82
|
+
return self.imputer_.transform(x)
|
83
|
+
|
84
|
+
def fit_transform(self, x, y=None):
|
85
|
+
"""Fit the imputer on the input data and transform it.
|
86
|
+
|
87
|
+
Returns:
|
88
|
+
The data with missing values imputed.
|
89
|
+
|
90
|
+
"""
|
91
|
+
self.fit(x, y)
|
92
|
+
return self.transform(x)
|
93
|
+
|
94
|
+
@classmethod
|
95
|
+
def _identity(cls, x):
|
96
|
+
return x
|
97
|
+
|
98
|
+
def __sklearn_is_fitted__(self) -> bool:
|
99
|
+
return self.in_feature_names is not None
|
@@ -3,6 +3,7 @@
|
|
3
3
|
# SPDX-License-Identifier: MPL-2.0
|
4
4
|
|
5
5
|
"""This module contains all wheather related functions used for feature engineering."""
|
6
|
+
import logging
|
6
7
|
from typing import Union
|
7
8
|
|
8
9
|
import numpy as np
|
@@ -12,7 +13,13 @@ import structlog
|
|
12
13
|
from pvlib.location import Location
|
13
14
|
|
14
15
|
from openstef.data_classes.prediction_job import PredictionJobDataClass
|
16
|
+
from openstef.settings import Settings
|
15
17
|
|
18
|
+
structlog.configure(
|
19
|
+
wrapper_class=structlog.make_filtering_bound_logger(
|
20
|
+
logging.getLevelName(Settings.log_level)
|
21
|
+
)
|
22
|
+
)
|
16
23
|
logger = structlog.get_logger(__name__)
|
17
24
|
|
18
25
|
|
@@ -431,3 +431,54 @@ def xgb_quantile_obj(
|
|
431
431
|
hess = np.ones_like(preds)
|
432
432
|
|
433
433
|
return grad, hess
|
434
|
+
|
435
|
+
|
436
|
+
def arctan_loss(y_true, y_pred, taus, s=0.1):
|
437
|
+
"""Compute the arctan pinball loss.
|
438
|
+
|
439
|
+
Note that XGBoost outputs the predictions in a slightly peculiar manner.
|
440
|
+
Suppose we have 100 data points and we predict 10 quantiles. The predictions
|
441
|
+
will be an array of size (1000 x 1). We first resize this to a (100x10) array
|
442
|
+
where each row corresponds to the 10 predicted quantile for a single data
|
443
|
+
point. We then use a for-loop (over the 10 columns) to calculate the gradients
|
444
|
+
and second derivatives. Legibility was chosen over efficiency. This part
|
445
|
+
can be made more efficient.
|
446
|
+
|
447
|
+
Args:
|
448
|
+
y_true: An array containing the true observations.
|
449
|
+
y_pred: An array containing the predicted quantiles.
|
450
|
+
taus: A list containing the true desired coverage of the quantiles.
|
451
|
+
s: A smoothing parameter.
|
452
|
+
|
453
|
+
Returns:
|
454
|
+
grad: An array containing the (negative) gradients with respect to y_pred.
|
455
|
+
hess: An array containing the second derivative with respect to y_pred.
|
456
|
+
|
457
|
+
"""
|
458
|
+
size = len(y_true)
|
459
|
+
n_dim = len(taus) # The number of columns
|
460
|
+
n_rows = size // n_dim
|
461
|
+
|
462
|
+
# Resize the predictions and targets.
|
463
|
+
# Each column corresponds to a quantile, each row to a data point.
|
464
|
+
y_pred = np.reshape(y_pred, (n_rows, n_dim))
|
465
|
+
y_true = np.reshape(y_true, (n_rows, n_dim))
|
466
|
+
|
467
|
+
# Calculate the differences
|
468
|
+
u = y_true - y_pred
|
469
|
+
|
470
|
+
# Calculate the gradient and second derivatives
|
471
|
+
grad = np.zeros_like(y_pred)
|
472
|
+
hess = np.zeros_like(y_pred)
|
473
|
+
z = u / s
|
474
|
+
for i, tau in enumerate(taus):
|
475
|
+
x = 1 + z[:, i] ** 2
|
476
|
+
grad[:, i] = (
|
477
|
+
tau - 0.5 + 1 / np.pi * np.arctan(z[:, i]) + z[:, i] / (np.pi) * x**-1
|
478
|
+
)
|
479
|
+
hess[:, i] = 2 / (np.pi * s) * x ** (-2)
|
480
|
+
|
481
|
+
# Reshape back to the original shape.
|
482
|
+
grad = grad.reshape(size)
|
483
|
+
hess = hess.reshape(size)
|
484
|
+
return -grad / n_dim, hess / n_dim
|
@@ -2,6 +2,7 @@
|
|
2
2
|
#
|
3
3
|
# SPDX-License-Identifier: MPL-2.0
|
4
4
|
"""Defines reporter class."""
|
5
|
+
import logging
|
5
6
|
import os
|
6
7
|
import warnings
|
7
8
|
from dataclasses import dataclass
|
@@ -16,6 +17,7 @@ from plotly.graph_objects import Figure
|
|
16
17
|
from openstef.metrics import figure
|
17
18
|
from openstef.metrics.metrics import bias, mae, nsme, r_mae, rmse
|
18
19
|
from openstef.model.regressors.regressor import OpenstfRegressor
|
20
|
+
from openstef.settings import Settings
|
19
21
|
|
20
22
|
|
21
23
|
@dataclass
|
@@ -167,6 +169,11 @@ class Reporter:
|
|
167
169
|
def write_report_to_disk(report: Report, report_folder: str):
|
168
170
|
"""Write report to disk; e.g. for viewing report of latest models using grafana."""
|
169
171
|
# Initialize logger and serializer
|
172
|
+
structlog.configure(
|
173
|
+
wrapper_class=structlog.make_filtering_bound_logger(
|
174
|
+
logging.getLevelName(Settings.log_level)
|
175
|
+
)
|
176
|
+
)
|
170
177
|
logger = structlog.get_logger(__name__)
|
171
178
|
if report_folder:
|
172
179
|
# create path if does not exist
|
@@ -1,6 +1,7 @@
|
|
1
1
|
# SPDX-FileCopyrightText: 2017-2023 Contributors to the OpenSTEF project <korte.termijn.prognoses@alliander.com> # noqa E501>
|
2
2
|
#
|
3
3
|
# SPDX-License-Identifier: MPL-2.0
|
4
|
+
import logging
|
4
5
|
from datetime import datetime
|
5
6
|
|
6
7
|
import numpy as np
|
@@ -11,12 +12,18 @@ from sklearn.base import RegressorMixin
|
|
11
12
|
|
12
13
|
from openstef.data_classes.prediction_job import PredictionJobDataClass
|
13
14
|
from openstef.exceptions import ModelWithoutStDev
|
15
|
+
from openstef.settings import Settings
|
14
16
|
|
15
17
|
|
16
18
|
class ConfidenceIntervalApplicator:
|
17
19
|
def __init__(self, model: RegressorMixin, forecast_input_data: pd.DataFrame):
|
18
20
|
self.model = model
|
19
21
|
self.forecast_input_data = forecast_input_data
|
22
|
+
structlog.configure(
|
23
|
+
wrapper_class=structlog.make_filtering_bound_logger(
|
24
|
+
logging.getLevelName(Settings.log_level)
|
25
|
+
)
|
26
|
+
)
|
20
27
|
self.logger = structlog.get_logger(self.__class__.__name__)
|
21
28
|
|
22
29
|
def add_confidence_interval(
|
@@ -54,9 +61,24 @@ class ConfidenceIntervalApplicator:
|
|
54
61
|
temp_forecast = self._add_standard_deviation_to_forecast(forecast)
|
55
62
|
|
56
63
|
if self.model.can_predict_quantiles:
|
57
|
-
|
58
|
-
|
59
|
-
|
64
|
+
# Try to generate the quantiles that were requested
|
65
|
+
try:
|
66
|
+
result = self._add_quantiles_to_forecast_quantile_regression(
|
67
|
+
temp_forecast, pj["quantiles"]
|
68
|
+
)
|
69
|
+
return result
|
70
|
+
except Exception:
|
71
|
+
# Fallback on quantiles of the model if the requested quantiles cant be generated by the model.
|
72
|
+
# Can happen when the model was trained on different quantiles than are requested
|
73
|
+
result = self._add_quantiles_to_forecast_quantile_regression(
|
74
|
+
temp_forecast, self.model.quantiles
|
75
|
+
)
|
76
|
+
self.logger.warning(
|
77
|
+
"Quantiles are requested the model was not trained on. Using the quantiles the model was trained on",
|
78
|
+
requested_quantiles=pj["quantiles"],
|
79
|
+
trained_quantiles=self.model.quantiles,
|
80
|
+
)
|
81
|
+
return result
|
60
82
|
|
61
83
|
return self._add_quantiles_to_forecast_default(temp_forecast, pj["quantiles"])
|
62
84
|
|