openstef 3.4.60__py3-none-any.whl → 3.4.61__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.
@@ -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.v1 import BaseModel
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
- arguments: Union[
20
- str, dict[str, Any]
21
- ] # JSON string holding the function parameters or dict
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 pydantic.v1 import BaseModel
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
- """Hyperparameters that should be used during training."""
16
- feature_names: Optional[list] = None
17
- """Features that should be used during training."""
18
- feature_modules: Optional[list] = []
19
- """Feature modules that should be used during training."""
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) -> any:
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: any) -> None:
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
@@ -2,132 +2,148 @@
2
2
  #
3
3
  # SPDX-License-Identifier: MPL-2.0
4
4
  """Specifies the prediction job dataclass."""
5
- from typing import Optional, Union
6
5
 
7
- from pydantic.v1 import BaseModel
6
+ from typing import Any, Optional, Union
7
+
8
+ from pydantic import BaseModel, Field
8
9
 
9
10
  from openstef.data_classes.data_prep import DataPrepDataClass
10
11
  from openstef.data_classes.model_specifications import ModelSpecificationDataClass
11
12
  from openstef.data_classes.split_function import SplitFuncDataClass
12
- from openstef.enums import PipelineType, BiddingZone, AggregateFunction
13
+ from openstef.enums import AggregateFunction, BiddingZone, PipelineType
13
14
 
14
15
 
15
16
  class PredictionJobDataClass(BaseModel):
16
17
  """Holds all information about the specific forecast that has to be made."""
17
18
 
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:
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:
120
136
  """Allows us to use subscription to get the items from the object."""
121
137
  return getattr(self, item)
122
138
 
123
- def __setitem__(self, key: str, value: any) -> None:
139
+ def __setitem__(self, key: str, value: Any) -> None:
124
140
  """Allows us to use subscription to set the items in the object."""
125
141
  if hasattr(self, key):
126
142
  self.__dict__[key] = value
127
143
  else:
128
144
  raise AttributeError(f"{key} not an attribute of prediction job.")
129
145
 
130
- def get(self, key: str, default: any = None) -> any:
146
+ def get(self, key: str, default: Any = None) -> Any:
131
147
  """Allows to use the get functions similar to a python dict."""
132
148
  if hasattr(self, key):
133
149
  return getattr(self, key)
@@ -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.v1 import BaseModel
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
- str, dict[str, Any]
19
- ] # JSON string holding the function parameters or dict
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: any):
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
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: openstef
3
- Version: 3.4.60
3
+ Version: 3.4.61
4
4
  Summary: Open short term energy forecaster
5
5
  Home-page: https://github.com/OpenSTEF/openstef
6
6
  Author: Alliander N.V
@@ -15,10 +15,10 @@ openstef/data/dazls_model_3.4.24/dazls_stored_3.4.24_baseline_model.z.license,sh
15
15
  openstef/data/dazls_model_3.4.24/dazls_stored_3.4.24_model_card.md,sha256=KJ8S8jg2k_aL1pCK_b3wOLMZqGdDALa4in73c4Am8gY,539
16
16
  openstef/data/dazls_model_3.4.24/dazls_stored_3.4.24_model_card.md.license,sha256=AxxHusqwIXU5RHl5ZMU65LyXmgtbj6QlcnFaOEN4kEE,145
17
17
  openstef/data_classes/__init__.py,sha256=bIyGTSA4V5VoOLTwdaiJJAnozmpSzvQooVYlsf8H4eU,163
18
- openstef/data_classes/data_prep.py,sha256=gRSL7UiHvZis8m8z7VoTCZc0Ccffhef5_hmSyApnqK0,3417
19
- openstef/data_classes/model_specifications.py,sha256=Uod1W3QzhRqVLb6zvXwxh9wRL3EHCzSvX0oDNd28cFk,1197
20
- openstef/data_classes/prediction_job.py,sha256=OFGg6h0XQZOIkJEYr1EoT3LE2oV6YULaCCxhkaES4wA,5874
21
- openstef/data_classes/split_function.py,sha256=ljQIQQu1t1Y_CVWGAy25jrM6wG9odIVVQVimrT1n-1s,3358
18
+ openstef/data_classes/data_prep.py,sha256=sANgFjfwmSWhLCfmLjfqXQnczuvVZfk2765jZd7LwuE,3691
19
+ openstef/data_classes/model_specifications.py,sha256=PZeBLfH_MrP9-QorL1r0Hklp0befE8Nw05vNhTX9Y20,1338
20
+ openstef/data_classes/prediction_job.py,sha256=pbvffqje7X7UGx2AC1LX2bvChiEd4n9brbxtS6-4_iE,6553
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=9Yzg61Whd4n0osQBfrcW8cI0gaUiv7u8KnQIQPR40fY,5327
24
24
  openstef/feature_engineering/bidding_zone_to_country_mapping.py,sha256=u9aabjFDImydkO6_cXiaQxBT4gb5zy0gGTg2EoIUO_Y,2106
@@ -95,8 +95,8 @@ openstef/tasks/utils/predictionjobloop.py,sha256=Ysy3zF5lzPMz_asYDKeF5m0qgVT3tCt
95
95
  openstef/tasks/utils/taskcontext.py,sha256=L9K14ycwgVxbIVUjH2DIn_QWbnu-OfxcGtQ1K9T6sus,5630
96
96
  openstef/validation/__init__.py,sha256=bIyGTSA4V5VoOLTwdaiJJAnozmpSzvQooVYlsf8H4eU,163
97
97
  openstef/validation/validation.py,sha256=6FY-mD7bWxM7NpM9y-RcGZJt-kyyOmPl8QSemYRY11w,11200
98
- openstef-3.4.60.dist-info/LICENSE,sha256=7Pm2fWFFHHUG5lDHed1vl5CjzxObIXQglnYsEdtjo_k,14907
99
- openstef-3.4.60.dist-info/METADATA,sha256=b9Mutfbm9_plLc8zVyV5rGI8PL285ILqpZgqsWlH42M,8305
100
- openstef-3.4.60.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
101
- openstef-3.4.60.dist-info/top_level.txt,sha256=kD0H4PqrQoncZ957FvqwfBxa89kTrun4Z_RAPs_HhLs,9
102
- openstef-3.4.60.dist-info/RECORD,,
98
+ openstef-3.4.61.dist-info/LICENSE,sha256=7Pm2fWFFHHUG5lDHed1vl5CjzxObIXQglnYsEdtjo_k,14907
99
+ openstef-3.4.61.dist-info/METADATA,sha256=9_xC8_cXy1j3ZWt4a-xHIaT1JZ2OlW1RUU3BEBYMhAg,8305
100
+ openstef-3.4.61.dist-info/WHEEL,sha256=nn6H5-ilmfVryoAQl3ZQ2l8SH5imPWFpm1A5FgEuFV4,91
101
+ openstef-3.4.61.dist-info/top_level.txt,sha256=kD0H4PqrQoncZ957FvqwfBxa89kTrun4Z_RAPs_HhLs,9
102
+ openstef-3.4.61.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (75.8.0)
2
+ Generator: setuptools (75.8.1)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5