openstef 3.4.60__tar.gz → 3.4.61__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.60 → openstef-3.4.61}/PKG-INFO +1 -1
- {openstef-3.4.60 → openstef-3.4.61}/openstef/data_classes/data_prep.py +10 -5
- {openstef-3.4.60 → openstef-3.4.61}/openstef/data_classes/model_specifications.py +15 -11
- openstef-3.4.61/openstef/data_classes/prediction_job.py +151 -0
- {openstef-3.4.60 → openstef-3.4.61}/openstef/data_classes/split_function.py +7 -6
- {openstef-3.4.60 → openstef-3.4.61}/openstef.egg-info/PKG-INFO +1 -1
- {openstef-3.4.60 → openstef-3.4.61}/setup.py +1 -1
- openstef-3.4.60/openstef/data_classes/prediction_job.py +0 -135
- {openstef-3.4.60 → openstef-3.4.61}/LICENSE +0 -0
- {openstef-3.4.60 → openstef-3.4.61}/README.md +0 -0
- {openstef-3.4.60 → openstef-3.4.61}/openstef/__init__.py +0 -0
- {openstef-3.4.60 → openstef-3.4.61}/openstef/__main__.py +0 -0
- {openstef-3.4.60 → openstef-3.4.61}/openstef/app_settings.py +0 -0
- {openstef-3.4.60 → openstef-3.4.61}/openstef/data/NL_terrestrial_radiation.csv +0 -0
- {openstef-3.4.60 → openstef-3.4.61}/openstef/data/NL_terrestrial_radiation.csv.license +0 -0
- {openstef-3.4.60 → openstef-3.4.61}/openstef/data/dazls_model_3.4.24/dazls_stored_3.4.24_baseline_model.z +0 -0
- {openstef-3.4.60 → openstef-3.4.61}/openstef/data/dazls_model_3.4.24/dazls_stored_3.4.24_baseline_model.z.license +0 -0
- {openstef-3.4.60 → openstef-3.4.61}/openstef/data/dazls_model_3.4.24/dazls_stored_3.4.24_model_card.md +0 -0
- {openstef-3.4.60 → openstef-3.4.61}/openstef/data/dazls_model_3.4.24/dazls_stored_3.4.24_model_card.md.license +0 -0
- {openstef-3.4.60 → openstef-3.4.61}/openstef/data/dutch_holidays.csv +0 -0
- {openstef-3.4.60 → openstef-3.4.61}/openstef/data/dutch_holidays.csv.license +0 -0
- {openstef-3.4.60 → openstef-3.4.61}/openstef/data/pv_single_coefs.csv +0 -0
- {openstef-3.4.60 → openstef-3.4.61}/openstef/data/pv_single_coefs.csv.license +0 -0
- {openstef-3.4.60 → openstef-3.4.61}/openstef/data_classes/__init__.py +0 -0
- {openstef-3.4.60 → openstef-3.4.61}/openstef/enums.py +0 -0
- {openstef-3.4.60 → openstef-3.4.61}/openstef/exceptions.py +0 -0
- {openstef-3.4.60 → openstef-3.4.61}/openstef/feature_engineering/__init__.py +0 -0
- {openstef-3.4.60 → openstef-3.4.61}/openstef/feature_engineering/apply_features.py +0 -0
- {openstef-3.4.60 → openstef-3.4.61}/openstef/feature_engineering/bidding_zone_to_country_mapping.py +0 -0
- {openstef-3.4.60 → openstef-3.4.61}/openstef/feature_engineering/cyclic_features.py +0 -0
- {openstef-3.4.60 → openstef-3.4.61}/openstef/feature_engineering/data_preparation.py +0 -0
- {openstef-3.4.60 → openstef-3.4.61}/openstef/feature_engineering/feature_adder.py +0 -0
- {openstef-3.4.60 → openstef-3.4.61}/openstef/feature_engineering/feature_applicator.py +0 -0
- {openstef-3.4.60 → openstef-3.4.61}/openstef/feature_engineering/general.py +0 -0
- {openstef-3.4.60 → openstef-3.4.61}/openstef/feature_engineering/holiday_features.py +0 -0
- {openstef-3.4.60 → openstef-3.4.61}/openstef/feature_engineering/lag_features.py +0 -0
- {openstef-3.4.60 → openstef-3.4.61}/openstef/feature_engineering/missing_values_transformer.py +0 -0
- {openstef-3.4.60 → openstef-3.4.61}/openstef/feature_engineering/rolling_features.py +0 -0
- {openstef-3.4.60 → openstef-3.4.61}/openstef/feature_engineering/weather_features.py +0 -0
- {openstef-3.4.60 → openstef-3.4.61}/openstef/metrics/__init__.py +0 -0
- {openstef-3.4.60 → openstef-3.4.61}/openstef/metrics/figure.py +0 -0
- {openstef-3.4.60 → openstef-3.4.61}/openstef/metrics/metrics.py +0 -0
- {openstef-3.4.60 → openstef-3.4.61}/openstef/metrics/reporter.py +0 -0
- {openstef-3.4.60 → openstef-3.4.61}/openstef/model/__init__.py +0 -0
- {openstef-3.4.60 → openstef-3.4.61}/openstef/model/basecase.py +0 -0
- {openstef-3.4.60 → openstef-3.4.61}/openstef/model/confidence_interval_applicator.py +0 -0
- {openstef-3.4.60 → openstef-3.4.61}/openstef/model/fallback.py +0 -0
- {openstef-3.4.60 → openstef-3.4.61}/openstef/model/metamodels/__init__.py +0 -0
- {openstef-3.4.60 → openstef-3.4.61}/openstef/model/metamodels/feature_clipper.py +0 -0
- {openstef-3.4.60 → openstef-3.4.61}/openstef/model/metamodels/grouped_regressor.py +0 -0
- {openstef-3.4.60 → openstef-3.4.61}/openstef/model/metamodels/missing_values_handler.py +0 -0
- {openstef-3.4.60 → openstef-3.4.61}/openstef/model/model_creator.py +0 -0
- {openstef-3.4.60 → openstef-3.4.61}/openstef/model/objective.py +0 -0
- {openstef-3.4.60 → openstef-3.4.61}/openstef/model/objective_creator.py +0 -0
- {openstef-3.4.60 → openstef-3.4.61}/openstef/model/regressors/__init__.py +0 -0
- {openstef-3.4.60 → openstef-3.4.61}/openstef/model/regressors/arima.py +0 -0
- {openstef-3.4.60 → openstef-3.4.61}/openstef/model/regressors/custom_regressor.py +0 -0
- {openstef-3.4.60 → openstef-3.4.61}/openstef/model/regressors/dazls.py +0 -0
- {openstef-3.4.60 → openstef-3.4.61}/openstef/model/regressors/flatliner.py +0 -0
- {openstef-3.4.60 → openstef-3.4.61}/openstef/model/regressors/gblinear_quantile.py +0 -0
- {openstef-3.4.60 → openstef-3.4.61}/openstef/model/regressors/lgbm.py +0 -0
- {openstef-3.4.60 → openstef-3.4.61}/openstef/model/regressors/linear.py +0 -0
- {openstef-3.4.60 → openstef-3.4.61}/openstef/model/regressors/linear_quantile.py +0 -0
- {openstef-3.4.60 → openstef-3.4.61}/openstef/model/regressors/regressor.py +0 -0
- {openstef-3.4.60 → openstef-3.4.61}/openstef/model/regressors/xgb.py +0 -0
- {openstef-3.4.60 → openstef-3.4.61}/openstef/model/regressors/xgb_multioutput_quantile.py +0 -0
- {openstef-3.4.60 → openstef-3.4.61}/openstef/model/regressors/xgb_quantile.py +0 -0
- {openstef-3.4.60 → openstef-3.4.61}/openstef/model/serializer.py +0 -0
- {openstef-3.4.60 → openstef-3.4.61}/openstef/model/standard_deviation_generator.py +0 -0
- {openstef-3.4.60 → openstef-3.4.61}/openstef/model_selection/__init__.py +0 -0
- {openstef-3.4.60 → openstef-3.4.61}/openstef/model_selection/model_selection.py +0 -0
- {openstef-3.4.60 → openstef-3.4.61}/openstef/monitoring/__init__.py +0 -0
- {openstef-3.4.60 → openstef-3.4.61}/openstef/monitoring/performance_meter.py +0 -0
- {openstef-3.4.60 → openstef-3.4.61}/openstef/monitoring/teams.py +0 -0
- {openstef-3.4.60 → openstef-3.4.61}/openstef/pipeline/__init__.py +0 -0
- {openstef-3.4.60 → openstef-3.4.61}/openstef/pipeline/create_basecase_forecast.py +0 -0
- {openstef-3.4.60 → openstef-3.4.61}/openstef/pipeline/create_component_forecast.py +0 -0
- {openstef-3.4.60 → openstef-3.4.61}/openstef/pipeline/create_forecast.py +0 -0
- {openstef-3.4.60 → openstef-3.4.61}/openstef/pipeline/optimize_hyperparameters.py +0 -0
- {openstef-3.4.60 → openstef-3.4.61}/openstef/pipeline/train_create_forecast_backtest.py +0 -0
- {openstef-3.4.60 → openstef-3.4.61}/openstef/pipeline/train_model.py +0 -0
- {openstef-3.4.60 → openstef-3.4.61}/openstef/pipeline/utils.py +0 -0
- {openstef-3.4.60 → openstef-3.4.61}/openstef/postprocessing/__init__.py +0 -0
- {openstef-3.4.60 → openstef-3.4.61}/openstef/postprocessing/postprocessing.py +0 -0
- {openstef-3.4.60 → openstef-3.4.61}/openstef/preprocessing/__init__.py +0 -0
- {openstef-3.4.60 → openstef-3.4.61}/openstef/preprocessing/preprocessing.py +0 -0
- {openstef-3.4.60 → openstef-3.4.61}/openstef/settings.py +0 -0
- {openstef-3.4.60 → openstef-3.4.61}/openstef/tasks/__init__.py +0 -0
- {openstef-3.4.60 → openstef-3.4.61}/openstef/tasks/calculate_kpi.py +0 -0
- {openstef-3.4.60 → openstef-3.4.61}/openstef/tasks/create_basecase_forecast.py +0 -0
- {openstef-3.4.60 → openstef-3.4.61}/openstef/tasks/create_components_forecast.py +0 -0
- {openstef-3.4.60 → openstef-3.4.61}/openstef/tasks/create_forecast.py +0 -0
- {openstef-3.4.60 → openstef-3.4.61}/openstef/tasks/create_solar_forecast.py +0 -0
- {openstef-3.4.60 → openstef-3.4.61}/openstef/tasks/create_wind_forecast.py +0 -0
- {openstef-3.4.60 → openstef-3.4.61}/openstef/tasks/optimize_hyperparameters.py +0 -0
- {openstef-3.4.60 → openstef-3.4.61}/openstef/tasks/split_forecast.py +0 -0
- {openstef-3.4.60 → openstef-3.4.61}/openstef/tasks/train_model.py +0 -0
- {openstef-3.4.60 → openstef-3.4.61}/openstef/tasks/utils/__init__.py +0 -0
- {openstef-3.4.60 → openstef-3.4.61}/openstef/tasks/utils/dependencies.py +0 -0
- {openstef-3.4.60 → openstef-3.4.61}/openstef/tasks/utils/predictionjobloop.py +0 -0
- {openstef-3.4.60 → openstef-3.4.61}/openstef/tasks/utils/taskcontext.py +0 -0
- {openstef-3.4.60 → openstef-3.4.61}/openstef/validation/__init__.py +0 -0
- {openstef-3.4.60 → openstef-3.4.61}/openstef/validation/validation.py +0 -0
- {openstef-3.4.60 → openstef-3.4.61}/openstef.egg-info/SOURCES.txt +0 -0
- {openstef-3.4.60 → openstef-3.4.61}/openstef.egg-info/dependency_links.txt +0 -0
- {openstef-3.4.60 → openstef-3.4.61}/openstef.egg-info/requires.txt +0 -0
- {openstef-3.4.60 → openstef-3.4.61}/openstef.egg-info/top_level.txt +0 -0
- {openstef-3.4.60 → openstef-3.4.61}/pyproject.toml +0 -0
- {openstef-3.4.60 → openstef-3.4.61}/setup.cfg +0 -0
@@ -2,12 +2,13 @@
|
|
2
2
|
#
|
3
3
|
# SPDX-License-Identifier: MPL-2.0
|
4
4
|
"""Specifies the split function dataclass."""
|
5
|
+
|
5
6
|
import inspect
|
6
7
|
import json
|
7
8
|
from importlib import import_module
|
8
9
|
from typing import Any, Sequence, TypeVar, Union
|
9
10
|
|
10
|
-
from pydantic
|
11
|
+
from pydantic import BaseModel, Field
|
11
12
|
|
12
13
|
DataPrepClass = TypeVar("DataPrepClass")
|
13
14
|
|
@@ -15,10 +16,14 @@ DataPrepClass = TypeVar("DataPrepClass")
|
|
15
16
|
class DataPrepDataClass(BaseModel):
|
16
17
|
"""Class that allows to specify a custom class to prepare the data (feature engineering , etc ...)."""
|
17
18
|
|
18
|
-
klass: Union[str, type[DataPrepClass]]
|
19
|
-
|
20
|
-
|
21
|
-
|
19
|
+
klass: Union[str, type[DataPrepClass]] = Field(
|
20
|
+
...,
|
21
|
+
description="The class that should be used to prepare the data. Can be a string with the path to the class or the class itself.",
|
22
|
+
)
|
23
|
+
arguments: Union[str, dict[str, Any]] = Field(
|
24
|
+
default=None,
|
25
|
+
description="The arguments that should be passed to the class. Can be a JSON string holding the function parameters or dict.",
|
26
|
+
)
|
22
27
|
|
23
28
|
def __getitem__(self, key: str):
|
24
29
|
"""Allows us to use subscription to get the items from the object."""
|
@@ -2,27 +2,31 @@
|
|
2
2
|
#
|
3
3
|
# SPDX-License-Identifier: MPL-2.0
|
4
4
|
"""Specifies the dataclass for model specifications."""
|
5
|
-
from typing import Optional, Union
|
6
5
|
|
7
|
-
from
|
6
|
+
from typing import Any, Optional, Union
|
7
|
+
|
8
|
+
from pydantic import BaseModel, Field
|
8
9
|
|
9
10
|
|
10
11
|
class ModelSpecificationDataClass(BaseModel):
|
11
12
|
"""Holds all information regarding the training procces of a specific model."""
|
12
13
|
|
13
|
-
id: Union[int, str]
|
14
|
-
hyper_params: Optional[dict] =
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
14
|
+
id: Union[int, str] = Field(description="The model id.")
|
15
|
+
hyper_params: Optional[dict] = Field(
|
16
|
+
default={}, description="Hyperparameters that should be used during training."
|
17
|
+
)
|
18
|
+
feature_names: Optional[list] = Field(
|
19
|
+
default=None, description="Features that should be used during training."
|
20
|
+
)
|
21
|
+
feature_modules: Optional[list] = Field(
|
22
|
+
default=[], description="Modules that should be used during training."
|
23
|
+
)
|
20
24
|
|
21
|
-
def __getitem__(self, item: str) ->
|
25
|
+
def __getitem__(self, item: str) -> Any:
|
22
26
|
"""Allows us to use subscription to get the items from the object."""
|
23
27
|
return getattr(self, item)
|
24
28
|
|
25
|
-
def __setitem__(self, key: str, value:
|
29
|
+
def __setitem__(self, key: str, value: Any) -> None:
|
26
30
|
"""Allows us to use subscription to set the items in the object."""
|
27
31
|
if hasattr(self, key):
|
28
32
|
self.__dict__[key] = value
|
@@ -0,0 +1,151 @@
|
|
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
|
+
"""Specifies the prediction job dataclass."""
|
5
|
+
|
6
|
+
from typing import Any, Optional, Union
|
7
|
+
|
8
|
+
from pydantic import BaseModel, Field
|
9
|
+
|
10
|
+
from openstef.data_classes.data_prep import DataPrepDataClass
|
11
|
+
from openstef.data_classes.model_specifications import ModelSpecificationDataClass
|
12
|
+
from openstef.data_classes.split_function import SplitFuncDataClass
|
13
|
+
from openstef.enums import AggregateFunction, BiddingZone, PipelineType
|
14
|
+
|
15
|
+
|
16
|
+
class PredictionJobDataClass(BaseModel):
|
17
|
+
"""Holds all information about the specific forecast that has to be made."""
|
18
|
+
|
19
|
+
id: Union[int, str] = Field(
|
20
|
+
..., description="The predictions job id (often abreviated as pid)."
|
21
|
+
)
|
22
|
+
model: str = Field(
|
23
|
+
...,
|
24
|
+
description="The model type that should be used. Options are: 'xgb', 'xgb_quantile', 'lgb', 'linear', 'linear_quantile', 'gblinear_quantile', 'xgb_multioutput_quantile', 'flatliner'.",
|
25
|
+
)
|
26
|
+
|
27
|
+
model_kwargs: Optional[dict] = Field(
|
28
|
+
default=None, description="The model parameters that should be used."
|
29
|
+
)
|
30
|
+
|
31
|
+
forecast_type: str = Field(
|
32
|
+
...,
|
33
|
+
description="The type of forecasts that should be made. Options are: 'demand', 'wind', 'basecase'. If unsure what to pick, choose 'demand'.",
|
34
|
+
)
|
35
|
+
horizon_minutes: Optional[int] = Field(
|
36
|
+
2880,
|
37
|
+
description="The horizon of the desired forecast in minutes used in tasks. Defaults to 2880 minutes (i.e. 2 days).",
|
38
|
+
)
|
39
|
+
|
40
|
+
resolution_minutes: int = Field(
|
41
|
+
60, description="The resolution of the desired forecast in minutes."
|
42
|
+
)
|
43
|
+
lat: Optional[float] = Field(
|
44
|
+
52.132633,
|
45
|
+
description="Latitude of the forecasted location in degrees. Used for fetching weather data in tasks, calculating derrived features and component splitting.",
|
46
|
+
)
|
47
|
+
lon: Optional[float] = Field(
|
48
|
+
5.291266,
|
49
|
+
description="Longitude of the forecasted location in degrees. Used for fetching weather data in tasks, calculating derrived features and component splitting.",
|
50
|
+
)
|
51
|
+
name: str = Field(..., description="Name of the forecast, e.g. the location name.")
|
52
|
+
|
53
|
+
electricity_bidding_zone: Optional[BiddingZone] = Field(
|
54
|
+
BiddingZone.NL,
|
55
|
+
description="The bidding zone of the forecasted location. Used for fetching electricity prices in tasks. It is also used to determine the holidays that should be used. Currently only ENTSO-E bidding zones are supported.",
|
56
|
+
)
|
57
|
+
train_components: Optional[bool] = Field(
|
58
|
+
None,
|
59
|
+
description="Whether splitting the forecasts in wind, solar, rest is desired.",
|
60
|
+
)
|
61
|
+
description: Optional[str] = Field(
|
62
|
+
None,
|
63
|
+
description="Optional description of the prediction job for human reference.",
|
64
|
+
)
|
65
|
+
|
66
|
+
quantiles: Optional[list[float]] = Field(
|
67
|
+
None,
|
68
|
+
description="Quantiles that have to be forecasted. Only used for quantile models.",
|
69
|
+
)
|
70
|
+
train_split_func: Optional[SplitFuncDataClass] = Field(
|
71
|
+
None, description="Optional custom splitting function for operational procces."
|
72
|
+
)
|
73
|
+
backtest_split_func: Optional[SplitFuncDataClass] = Field(
|
74
|
+
None, description="Optional custom splitting function for backtesting."
|
75
|
+
)
|
76
|
+
train_horizons_minutes: Optional[list[int]] = Field(
|
77
|
+
None,
|
78
|
+
description="List of horizons that should be taken into account during training.",
|
79
|
+
)
|
80
|
+
default_modelspecs: Optional[ModelSpecificationDataClass] = Field(
|
81
|
+
None, description="Default model specifications"
|
82
|
+
)
|
83
|
+
save_train_forecasts: bool = Field(
|
84
|
+
False,
|
85
|
+
description="Indicate wether the forecasts produced during the training process should be saved.",
|
86
|
+
)
|
87
|
+
completeness_threshold: float = Field(
|
88
|
+
0.5,
|
89
|
+
description="Minimum fraction of data that should be available for making a regular forecast.",
|
90
|
+
)
|
91
|
+
minimal_table_length: int = Field(
|
92
|
+
100,
|
93
|
+
description="Minimum length (in rows) of the forecast input for making a regular forecast.",
|
94
|
+
)
|
95
|
+
flatliner_threshold_minutes: int = Field(
|
96
|
+
1440,
|
97
|
+
description="Number of minutes that the load has to be constant to detect a flatliner.",
|
98
|
+
)
|
99
|
+
data_balancing_ratio: Optional[float] = Field(
|
100
|
+
None,
|
101
|
+
description="If data balancing is enabled, the data will be balanced with data from 1 year ago in the future.",
|
102
|
+
)
|
103
|
+
rolling_aggregate_features: Optional[list[AggregateFunction]] = Field(
|
104
|
+
[],
|
105
|
+
description="If not None, rolling aggregate(s) of load will be used as features in the model.",
|
106
|
+
)
|
107
|
+
depends_on: Optional[list[Union[int, str]]] = Field(
|
108
|
+
[],
|
109
|
+
description="Link to another prediction job on which this prediction job might depend.",
|
110
|
+
)
|
111
|
+
sid: Optional[str] = Field(
|
112
|
+
None, description="Only required for create_solar_forecast task"
|
113
|
+
)
|
114
|
+
turbine_type: Optional[str] = Field(
|
115
|
+
None, description="Only required for create_wind_forecast task"
|
116
|
+
)
|
117
|
+
n_turbines: Optional[float] = Field(
|
118
|
+
None, description="Only required for create_wind_forecast task"
|
119
|
+
)
|
120
|
+
hub_height: Optional[float] = Field(
|
121
|
+
None, description="Only required for create_wind_forecast task"
|
122
|
+
)
|
123
|
+
pipelines_to_run: list[PipelineType] = Field(
|
124
|
+
[PipelineType.TRAIN, PipelineType.HYPER_PARMATERS, PipelineType.FORECAST],
|
125
|
+
description="The pipelines to run for this pj",
|
126
|
+
)
|
127
|
+
alternative_forecast_model_pid: Optional[Union[int, str]] = Field(
|
128
|
+
None,
|
129
|
+
description="The pid that references another prediction job from which the model should be used for making forecasts.",
|
130
|
+
)
|
131
|
+
data_prep_class: Optional[DataPrepDataClass] = Field(
|
132
|
+
None, description="The import string for the custom data prep class"
|
133
|
+
)
|
134
|
+
|
135
|
+
def __getitem__(self, item: str) -> Any:
|
136
|
+
"""Allows us to use subscription to get the items from the object."""
|
137
|
+
return getattr(self, item)
|
138
|
+
|
139
|
+
def __setitem__(self, key: str, value: Any) -> None:
|
140
|
+
"""Allows us to use subscription to set the items in the object."""
|
141
|
+
if hasattr(self, key):
|
142
|
+
self.__dict__[key] = value
|
143
|
+
else:
|
144
|
+
raise AttributeError(f"{key} not an attribute of prediction job.")
|
145
|
+
|
146
|
+
def get(self, key: str, default: Any = None) -> Any:
|
147
|
+
"""Allows to use the get functions similar to a python dict."""
|
148
|
+
if hasattr(self, key):
|
149
|
+
return getattr(self, key)
|
150
|
+
else:
|
151
|
+
return default
|
@@ -2,27 +2,28 @@
|
|
2
2
|
#
|
3
3
|
# SPDX-License-Identifier: MPL-2.0
|
4
4
|
"""Specifies the split function dataclass."""
|
5
|
+
|
5
6
|
import inspect
|
6
7
|
import json
|
7
8
|
from importlib import import_module
|
8
9
|
from typing import Any, Callable, Sequence, Union
|
9
10
|
|
10
|
-
from pydantic
|
11
|
+
from pydantic import BaseModel, Field
|
11
12
|
|
12
13
|
|
13
14
|
class SplitFuncDataClass(BaseModel):
|
14
15
|
"""Class that allows to specify a custom function to generate a train, test and validation set."""
|
15
16
|
|
16
|
-
function: Union[str, Callable]
|
17
|
-
arguments: Union[
|
18
|
-
|
19
|
-
|
17
|
+
function: Union[str, Callable] = Field(..., description="The split function")
|
18
|
+
arguments: Union[str, dict[str, Any]] = Field(
|
19
|
+
..., description="JSON string holding the function parameters or dict"
|
20
|
+
)
|
20
21
|
|
21
22
|
def __getitem__(self, key: str):
|
22
23
|
"""Allows us to use subscription to get the items from the object."""
|
23
24
|
return getattr(self, key)
|
24
25
|
|
25
|
-
def __setitem__(self, key: str, value:
|
26
|
+
def __setitem__(self, key: str, value: Any):
|
26
27
|
"""Allows us to use subscription to set the items in the object."""
|
27
28
|
if hasattr(self, key):
|
28
29
|
self.__dict__[key] = value
|
@@ -29,7 +29,7 @@ def read_long_description_from_readme():
|
|
29
29
|
|
30
30
|
setup(
|
31
31
|
name="openstef",
|
32
|
-
version="3.4.
|
32
|
+
version="3.4.61",
|
33
33
|
packages=find_packages(include=["openstef", "openstef.*"]),
|
34
34
|
description="Open short term energy forecaster",
|
35
35
|
long_description=read_long_description_from_readme(),
|
@@ -1,135 +0,0 @@
|
|
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
|
-
"""Specifies the prediction job dataclass."""
|
5
|
-
from typing import Optional, Union
|
6
|
-
|
7
|
-
from pydantic.v1 import BaseModel
|
8
|
-
|
9
|
-
from openstef.data_classes.data_prep import DataPrepDataClass
|
10
|
-
from openstef.data_classes.model_specifications import ModelSpecificationDataClass
|
11
|
-
from openstef.data_classes.split_function import SplitFuncDataClass
|
12
|
-
from openstef.enums import PipelineType, BiddingZone, AggregateFunction
|
13
|
-
|
14
|
-
|
15
|
-
class PredictionJobDataClass(BaseModel):
|
16
|
-
"""Holds all information about the specific forecast that has to be made."""
|
17
|
-
|
18
|
-
id: Union[int, str]
|
19
|
-
"""The predictions job id (often abreviated as pid)."""
|
20
|
-
model: str
|
21
|
-
"""The model type that should be used.
|
22
|
-
|
23
|
-
Options are:
|
24
|
-
- ``"xgb"``
|
25
|
-
- ``"xgb_quantile"``
|
26
|
-
- ``"lgb"``
|
27
|
-
- ``"linear"``
|
28
|
-
- ``"linear_quantile"``
|
29
|
-
- ``"gblinear_quantile"``
|
30
|
-
- ``"xgb_multioutput_quantile"``
|
31
|
-
- ``"flatliner"``
|
32
|
-
|
33
|
-
If unsure what to pick, choose ``"xgb"``.
|
34
|
-
|
35
|
-
"""
|
36
|
-
model_kwargs: Optional[dict]
|
37
|
-
"""The model parameters that should be used."""
|
38
|
-
forecast_type: str
|
39
|
-
"""The type of forecasts that should be made.
|
40
|
-
|
41
|
-
Options are:
|
42
|
-
- ``"demand"``
|
43
|
-
- ``"wind"``
|
44
|
-
- ``"basecase"``
|
45
|
-
|
46
|
-
If unsure what to pick, choose ``"demand"``.
|
47
|
-
|
48
|
-
"""
|
49
|
-
horizon_minutes: Optional[int] = 2880
|
50
|
-
"""The horizon of the desired forecast in minutes used in tasks. Defaults to 2880 minutes (i.e. 2 days)."""
|
51
|
-
resolution_minutes: int
|
52
|
-
"""The resolution of the desired forecast in minutes."""
|
53
|
-
lat: Optional[float] = 52.132633
|
54
|
-
"""Latitude of the forecasted location in degrees. Used for fetching weather data in tasks, calculating derrived features and component splitting."""
|
55
|
-
lon: Optional[float] = 5.291266
|
56
|
-
"""Longitude of the forecasted location in degrees. Used for fetching weather data in tasks, calculating derrived features and component splitting."""
|
57
|
-
name: str
|
58
|
-
"""Bidding zone is used to determine the electricity price. It is also used to determine the holidays that should be used. Currently only ENTSO-E bidding zones are supported."""
|
59
|
-
electricity_bidding_zone: Optional[BiddingZone] = BiddingZone.NL
|
60
|
-
"""Name of the forecast, e.g. the location name."""
|
61
|
-
train_components: Optional[bool]
|
62
|
-
"""Whether splitting the forecasts in wind, solar, rest is desired."""
|
63
|
-
description: Optional[str]
|
64
|
-
"""Optional description of the prediction job for human reference."""
|
65
|
-
quantiles: Optional[list[float]]
|
66
|
-
"""Quantiles that have to be forecasted."""
|
67
|
-
train_split_func: Optional[SplitFuncDataClass]
|
68
|
-
"""Optional custom splitting function for operational procces."""
|
69
|
-
backtest_split_func: Optional[SplitFuncDataClass]
|
70
|
-
"""Optional custom splitting function for backtesting."""
|
71
|
-
train_horizons_minutes: Optional[list[int]]
|
72
|
-
"""List of horizons that should be taken into account during training."""
|
73
|
-
default_modelspecs: Optional[ModelSpecificationDataClass]
|
74
|
-
"""Default model specifications"""
|
75
|
-
save_train_forecasts: bool = False
|
76
|
-
"""Indicate wether the forecasts produced during the training process should be saved."""
|
77
|
-
completeness_threshold: float = 0.5
|
78
|
-
"""Minimum fraction of data that should be available for making a regular forecast."""
|
79
|
-
minimal_table_length: int = 100
|
80
|
-
"""Minimum length (in rows) of the forecast input for making a regular forecast."""
|
81
|
-
flatliner_threshold_minutes: int = 1440
|
82
|
-
"""Number of minutes that the load has to be constant to detect a flatliner. """
|
83
|
-
data_balancing_ratio: Optional[float] = None
|
84
|
-
"""If data balancing is enabled, the data will be balanced with data from 1 year
|
85
|
-
ago in the future."""
|
86
|
-
rolling_aggregate_features: Optional[list[AggregateFunction]] = None
|
87
|
-
"""If not None, rolling aggregate(s) of load will be used as features in the model."""
|
88
|
-
depends_on: Optional[list[Union[int, str]]]
|
89
|
-
"""Link to another prediction job on which this prediction job might depend."""
|
90
|
-
sid: Optional[str]
|
91
|
-
"""Only required for create_solar_forecast task"""
|
92
|
-
turbine_type: Optional[str]
|
93
|
-
"""Only required for create_wind_forecast task"""
|
94
|
-
n_turbines: Optional[float]
|
95
|
-
"""Only required for create_wind_forecast task"""
|
96
|
-
hub_height: Optional[float]
|
97
|
-
"""Only required for create_wind_forecast task"""
|
98
|
-
pipelines_to_run: list[PipelineType] = [
|
99
|
-
PipelineType.TRAIN,
|
100
|
-
PipelineType.HYPER_PARMATERS,
|
101
|
-
PipelineType.FORECAST,
|
102
|
-
]
|
103
|
-
"""The pipelines to run for this pj"""
|
104
|
-
alternative_forecast_model_pid: Optional[Union[int, str]]
|
105
|
-
"""The pid that references another prediction job from which the model should be used for making forecasts."""
|
106
|
-
data_prep_class: Optional[DataPrepDataClass]
|
107
|
-
"""The import string for the custom data prep class"""
|
108
|
-
|
109
|
-
class Config:
|
110
|
-
"""Pydantic model configuration.
|
111
|
-
|
112
|
-
This following configuration is needed to prevent ids in "depends_on" to be converted from int to str when we
|
113
|
-
use integer ids.
|
114
|
-
|
115
|
-
"""
|
116
|
-
|
117
|
-
smart_union = True
|
118
|
-
|
119
|
-
def __getitem__(self, item: str) -> any:
|
120
|
-
"""Allows us to use subscription to get the items from the object."""
|
121
|
-
return getattr(self, item)
|
122
|
-
|
123
|
-
def __setitem__(self, key: str, value: any) -> None:
|
124
|
-
"""Allows us to use subscription to set the items in the object."""
|
125
|
-
if hasattr(self, key):
|
126
|
-
self.__dict__[key] = value
|
127
|
-
else:
|
128
|
-
raise AttributeError(f"{key} not an attribute of prediction job.")
|
129
|
-
|
130
|
-
def get(self, key: str, default: any = None) -> any:
|
131
|
-
"""Allows to use the get functions similar to a python dict."""
|
132
|
-
if hasattr(self, key):
|
133
|
-
return getattr(self, key)
|
134
|
-
else:
|
135
|
-
return default
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{openstef-3.4.60 → openstef-3.4.61}/openstef/feature_engineering/bidding_zone_to_country_mapping.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{openstef-3.4.60 → openstef-3.4.61}/openstef/feature_engineering/missing_values_transformer.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|