openstef 3.4.75__py3-none-any.whl → 3.4.77__py3-none-any.whl
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/data_classes/prediction_job.py +11 -1
- openstef/enums.py +5 -0
- openstef/model/fallback.py +14 -6
- openstef/pipeline/create_forecast.py +2 -1
- openstef/postprocessing/postprocessing.py +6 -1
- {openstef-3.4.75.dist-info → openstef-3.4.77.dist-info}/METADATA +1 -1
- {openstef-3.4.75.dist-info → openstef-3.4.77.dist-info}/RECORD +10 -10
- {openstef-3.4.75.dist-info → openstef-3.4.77.dist-info}/WHEEL +1 -1
- {openstef-3.4.75.dist-info → openstef-3.4.77.dist-info}/licenses/LICENSE +0 -0
- {openstef-3.4.75.dist-info → openstef-3.4.77.dist-info}/top_level.txt +0 -0
@@ -10,7 +10,12 @@ from pydantic import BaseModel, Field
|
|
10
10
|
from openstef.data_classes.data_prep import DataPrepDataClass
|
11
11
|
from openstef.data_classes.model_specifications import ModelSpecificationDataClass
|
12
12
|
from openstef.data_classes.split_function import SplitFuncDataClass
|
13
|
-
from openstef.enums import
|
13
|
+
from openstef.enums import (
|
14
|
+
AggregateFunction,
|
15
|
+
BiddingZone,
|
16
|
+
PipelineType,
|
17
|
+
FallbackStrategy,
|
18
|
+
)
|
14
19
|
|
15
20
|
|
16
21
|
class PredictionJobDataClass(BaseModel):
|
@@ -136,6 +141,11 @@ class PredictionJobDataClass(BaseModel):
|
|
136
141
|
None, description="The import string for the custom data prep class"
|
137
142
|
)
|
138
143
|
|
144
|
+
fallback_strategy: Optional[FallbackStrategy] = Field(
|
145
|
+
FallbackStrategy.EXTREME_DAY,
|
146
|
+
description="The fallback strategy to use when not enough input data is available.",
|
147
|
+
)
|
148
|
+
|
139
149
|
def __getitem__(self, item: str) -> Any:
|
140
150
|
"""Allows us to use subscription to get the items from the object."""
|
141
151
|
return getattr(self, item)
|
openstef/enums.py
CHANGED
openstef/model/fallback.py
CHANGED
@@ -5,11 +5,13 @@ from datetime import UTC, datetime
|
|
5
5
|
|
6
6
|
import pandas as pd
|
7
7
|
|
8
|
+
from openstef.enums import FallbackStrategy
|
9
|
+
|
8
10
|
|
9
11
|
def generate_fallback(
|
10
12
|
forecast_input: pd.DataFrame,
|
11
13
|
load: pd.DataFrame,
|
12
|
-
fallback_strategy:
|
14
|
+
fallback_strategy: FallbackStrategy = FallbackStrategy.EXTREME_DAY,
|
13
15
|
) -> pd.DataFrame:
|
14
16
|
"""Make a fall back forecast, Set the value of the forecast 'quality' column to 'substituted'.
|
15
17
|
|
@@ -20,6 +22,7 @@ def generate_fallback(
|
|
20
22
|
load: index=datetime, columns=['load']
|
21
23
|
fallback_strategy: strategy to determine fallback. options:
|
22
24
|
- extreme_day: use daily profile of most extreme day
|
25
|
+
- raise_error: raise error if not enough data is available
|
23
26
|
Returns:
|
24
27
|
Fallback forecast DataFrame with columns; 'forecast', 'quality'
|
25
28
|
|
@@ -32,12 +35,17 @@ def generate_fallback(
|
|
32
35
|
if len(load.dropna()) == 0:
|
33
36
|
raise ValueError("No historic load data available")
|
34
37
|
|
35
|
-
if fallback_strategy
|
36
|
-
|
37
|
-
|
38
|
-
|
38
|
+
if fallback_strategy not in [
|
39
|
+
FallbackStrategy.RAISE_ERROR,
|
40
|
+
FallbackStrategy.EXTREME_DAY,
|
41
|
+
]:
|
42
|
+
raise NotImplementedError("Fallback strategy not implemented")
|
43
|
+
|
44
|
+
if fallback_strategy == FallbackStrategy.RAISE_ERROR:
|
45
|
+
# Raise error if not enough data is available
|
46
|
+
raise ValueError("Not enough load data available to generate forecast")
|
39
47
|
|
40
|
-
if fallback_strategy ==
|
48
|
+
if fallback_strategy == FallbackStrategy.EXTREME_DAY:
|
41
49
|
# Execute this fallback strategy
|
42
50
|
# Find most extreme historic day and merge it by time-of-day to the requested moments
|
43
51
|
|
@@ -20,6 +20,7 @@ from openstef.postprocessing.postprocessing import (
|
|
20
20
|
sort_quantiles,
|
21
21
|
)
|
22
22
|
from openstef.validation import validation
|
23
|
+
from openstef.enums import FallbackStrategy
|
23
24
|
|
24
25
|
|
25
26
|
def create_forecast_pipeline(
|
@@ -88,7 +89,7 @@ def create_forecast_pipeline_core(
|
|
88
89
|
"""
|
89
90
|
logger = get_logger(__name__)
|
90
91
|
|
91
|
-
fallback_strategy = "
|
92
|
+
fallback_strategy = pj.get("fallback_strategy", FallbackStrategy.EXTREME_DAY)
|
92
93
|
|
93
94
|
# Validate and clean data
|
94
95
|
validated_data = validation.validate(
|
@@ -255,9 +255,14 @@ def sort_quantiles(
|
|
255
255
|
if len(p_columns) == 0:
|
256
256
|
return forecast
|
257
257
|
|
258
|
-
#
|
258
|
+
# Sort the columns
|
259
259
|
p_columns = np.sort(p_columns)
|
260
260
|
|
261
261
|
forecast.loc[:, p_columns] = forecast[p_columns].apply(sorted, axis=1).to_list()
|
262
262
|
|
263
|
+
# Set the forecast columun equal to the median if available
|
264
|
+
median_col = f"{quantile_col_start}50"
|
265
|
+
if median_col in forecast.columns:
|
266
|
+
forecast["forecast"] = forecast[median_col]
|
267
|
+
|
263
268
|
return forecast
|
@@ -1,7 +1,7 @@
|
|
1
1
|
openstef/__init__.py,sha256=93UM6m0LLQhO69-mSqLuUy73jgs4W7Iuxfo3Lm8c98g,419
|
2
2
|
openstef/__main__.py,sha256=bIyGTSA4V5VoOLTwdaiJJAnozmpSzvQooVYlsf8H4eU,163
|
3
3
|
openstef/app_settings.py,sha256=4SiEoPfPmM_Vc9gwWleT_IRxHIk36bZaYRCdNf3ewoo,762
|
4
|
-
openstef/enums.py,sha256=
|
4
|
+
openstef/enums.py,sha256=_nhwTY5-bV14ydv4nA06KEZ1xsI53oNqMX963P10jgg,2947
|
5
5
|
openstef/exceptions.py,sha256=dgnvZe5WWuJWCZm_GES6suEATbusPlwbiEUfNQKeExY,1993
|
6
6
|
openstef/settings.py,sha256=nSgkBqFxuqB3w7Rwo60i8j37c5ngDbt6vpjHS6QtJXQ,354
|
7
7
|
openstef/data/NL_terrestrial_radiation.csv,sha256=A4kbW56GDzWi4tWUwY2C-4PiOvcKJCwkWQQtdg4ekPE,820246
|
@@ -17,7 +17,7 @@ openstef/data/dazls_model_3.4.24/dazls_stored_3.4.24_model_card.md.license,sha25
|
|
17
17
|
openstef/data_classes/__init__.py,sha256=bIyGTSA4V5VoOLTwdaiJJAnozmpSzvQooVYlsf8H4eU,163
|
18
18
|
openstef/data_classes/data_prep.py,sha256=sANgFjfwmSWhLCfmLjfqXQnczuvVZfk2765jZd7LwuE,3691
|
19
19
|
openstef/data_classes/model_specifications.py,sha256=PZeBLfH_MrP9-QorL1r0Hklp0befE8Nw05vNhTX9Y20,1338
|
20
|
-
openstef/data_classes/prediction_job.py,sha256=
|
20
|
+
openstef/data_classes/prediction_job.py,sha256=HS2ZjhOoF4EdQRttOiTM0W1E7z5ZNjBglMpcSSZvoCY,6967
|
21
21
|
openstef/data_classes/split_function.py,sha256=K8y1dsQC5exeIDh37f7UwJ11tV71_uVSNbnKmwXpnOM,3435
|
22
22
|
openstef/feature_engineering/__init__.py,sha256=bIyGTSA4V5VoOLTwdaiJJAnozmpSzvQooVYlsf8H4eU,163
|
23
23
|
openstef/feature_engineering/apply_features.py,sha256=pro4eUmOFexX_9g9kJtDcbrQ1hWKzXjVpiJBmmBi89o,5326
|
@@ -45,7 +45,7 @@ openstef/metrics/reporter.py,sha256=2F1uRmh2MC-JH8Lsr1xGLxUFYDGfQ0Q85Pcjcc31TP0,
|
|
45
45
|
openstef/model/__init__.py,sha256=bIyGTSA4V5VoOLTwdaiJJAnozmpSzvQooVYlsf8H4eU,163
|
46
46
|
openstef/model/basecase.py,sha256=caI6Q-8y0ymlxGK9Js_H3Vh0q6ruNHlGD5RG0_kE5M0,2878
|
47
47
|
openstef/model/confidence_interval_applicator.py,sha256=VOdHsDJhfeyaq_cnk9QMUaZ2IumbiBBoW1zo8AuqDg0,9559
|
48
|
-
openstef/model/fallback.py,sha256=
|
48
|
+
openstef/model/fallback.py,sha256=x60GVyl1c5DpebzkjJEMToZpMTD1c4FrhM-tBN9uizk,3177
|
49
49
|
openstef/model/model_creator.py,sha256=fnhcVGUHskbuAys5kjlJ4GXKxbi9Eq5eAA19ex11Vv0,6658
|
50
50
|
openstef/model/objective.py,sha256=0PZUbPzuyaYlpWEH_qPavO6ll7zwqTTUTfIrUzzFMbs,15585
|
51
51
|
openstef/model/objective_creator.py,sha256=3jJgcmY1sm-Yoe3SfjKrJukrsqtYyloUFaPbBWqswhQ,2208
|
@@ -77,7 +77,7 @@ openstef/monitoring/teams.py,sha256=klN7Ge-0VktJbZ_I-K8MJIc3LWgdNy0MGL8b2TdoUR8,
|
|
77
77
|
openstef/pipeline/__init__.py,sha256=bIyGTSA4V5VoOLTwdaiJJAnozmpSzvQooVYlsf8H4eU,163
|
78
78
|
openstef/pipeline/create_basecase_forecast.py,sha256=7IShIjEmjkzpNzWzQVKmYQvy0q_uwCGO-E0mSRmGdhw,4397
|
79
79
|
openstef/pipeline/create_component_forecast.py,sha256=40fYKajdj4F9K7fzmL3euyvwTr0v-oO_5cXpya87A0c,5839
|
80
|
-
openstef/pipeline/create_forecast.py,sha256=
|
80
|
+
openstef/pipeline/create_forecast.py,sha256=rLGU7DXqAQNH_pkqIF8tvjOq0NldnKTKH2sylLrNiRg,5640
|
81
81
|
openstef/pipeline/optimize_hyperparameters.py,sha256=w5LpZhW3KVklCJzaogNzyHfpMJfNqeRAnvyV4vi35wg,10953
|
82
82
|
openstef/pipeline/train_create_forecast_backtest.py,sha256=hBJPxfDkbrmFSSGZrRH1vTiIVqJP-SWe0ibVpHT_8Qg,6048
|
83
83
|
openstef/pipeline/train_model.py,sha256=O1pyATMQUkNZQ01FlOwG8r3gtKwRcx7YD73f-91umuo,19948
|
@@ -85,7 +85,7 @@ openstef/pipeline/utils.py,sha256=23mB31p19FoGWelLJzxNmqlzGwEr3fCDBEA37V2kpYY,21
|
|
85
85
|
openstef/plotting/__init__.py,sha256=KQjXzyafCt1bE7XDrSeV4TDUIO7MkwN_Br4ASOcNI2g,163
|
86
86
|
openstef/plotting/load_forecast_plotter.py,sha256=GWHVmUB2YosNj7TnSrMnxYAfM2Z1mNg5oRV9A_lJmQY,8129
|
87
87
|
openstef/postprocessing/__init__.py,sha256=bIyGTSA4V5VoOLTwdaiJJAnozmpSzvQooVYlsf8H4eU,163
|
88
|
-
openstef/postprocessing/postprocessing.py,sha256=
|
88
|
+
openstef/postprocessing/postprocessing.py,sha256=lKYsI-ckDy0jUwLPr1AlFRSfoMHMkXvnHuUFwomaJFM,9015
|
89
89
|
openstef/preprocessing/__init__.py,sha256=bIyGTSA4V5VoOLTwdaiJJAnozmpSzvQooVYlsf8H4eU,163
|
90
90
|
openstef/preprocessing/preprocessing.py,sha256=bM_cSSSb2vGTD79RGzUrI6KoELbzlCyJwc7jqQGNEsE,1454
|
91
91
|
openstef/tasks/__init__.py,sha256=bIyGTSA4V5VoOLTwdaiJJAnozmpSzvQooVYlsf8H4eU,163
|
@@ -104,8 +104,8 @@ openstef/tasks/utils/predictionjobloop.py,sha256=Ysy3zF5lzPMz_asYDKeF5m0qgVT3tCt
|
|
104
104
|
openstef/tasks/utils/taskcontext.py,sha256=O-LZ_wHEl5vbT8oB7EYtOeMkvk6EqCnI1-KiyER7Eu4,5407
|
105
105
|
openstef/validation/__init__.py,sha256=bIyGTSA4V5VoOLTwdaiJJAnozmpSzvQooVYlsf8H4eU,163
|
106
106
|
openstef/validation/validation.py,sha256=r6UqkdH5TMjsGfn8Ta07K1jkqmrVmwcPGfyQvMmZyO4,11459
|
107
|
-
openstef-3.4.
|
108
|
-
openstef-3.4.
|
109
|
-
openstef-3.4.
|
110
|
-
openstef-3.4.
|
111
|
-
openstef-3.4.
|
107
|
+
openstef-3.4.77.dist-info/licenses/LICENSE,sha256=7Pm2fWFFHHUG5lDHed1vl5CjzxObIXQglnYsEdtjo_k,14907
|
108
|
+
openstef-3.4.77.dist-info/METADATA,sha256=d8ogfqGlSvJIz8uiS3H2n66frGodeTDiGS4dAhjkve0,8834
|
109
|
+
openstef-3.4.77.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
110
|
+
openstef-3.4.77.dist-info/top_level.txt,sha256=kD0H4PqrQoncZ957FvqwfBxa89kTrun4Z_RAPs_HhLs,9
|
111
|
+
openstef-3.4.77.dist-info/RECORD,,
|
File without changes
|
File without changes
|