openstef 3.4.31__py3-none-any.whl → 3.4.33__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.
@@ -0,0 +1,3 @@
1
+ SPDX-FileCopyrightText: 2017-2023 Contributors to the OpenSTEF project <korte.termijn.prognoses@alliander.com>
2
+
3
+ SPDX-License-Identifier: MPL-2.0
@@ -0,0 +1,18 @@
1
+
2
+ # Model details : dazls\_model\_baseline\_model
3
+
4
+ ## Description
5
+ **Model Name**: dazls\_model\_baseline\_model
6
+
7
+ **Author**: KTP, Alliander
8
+
9
+ **Model type**: Energy splitting model
10
+
11
+ **Model Architecture**: LinearRegression
12
+
13
+ **Date**: 2024-04-26
14
+
15
+ ## Intended use
16
+ This is a DAZLs model aimed at determining the energy splits for substations.
17
+ Each of these splits are determined based on a set of features that are available in production,
18
+ and in this case have their origin in the Dutch energy grid.********************
@@ -0,0 +1,3 @@
1
+ SPDX-FileCopyrightText: 2017-2023 Contributors to the OpenSTEF project <korte.termijn.prognoses@alliander.com>
2
+
3
+ SPDX-License-Identifier: MPL-2.0
@@ -7,7 +7,7 @@ import numpy as np
7
7
  import pandas as pd
8
8
  from sklearn.impute import SimpleImputer
9
9
  from sklearn.preprocessing import FunctionTransformer
10
- from sklearn.utils.validation import check_array
10
+ from sklearn.utils.validation import check_array, check_is_fitted
11
11
 
12
12
 
13
13
  class MissingValuesTransformer:
@@ -42,6 +42,20 @@ class MissingValuesTransformer:
42
42
  self.missing_values = missing_values
43
43
  self.imputation_strategy = imputation_strategy
44
44
  self.fill_value = fill_value
45
+ self.is_fitted_ = False
46
+
47
+ # Build the proper imputation transformer
48
+ # - Identity function if strategy is None
49
+ # - SimpleImputer with the dedicated strategy
50
+ if self.imputation_strategy is None:
51
+ self.imputer_ = FunctionTransformer(func=self._identity)
52
+ else:
53
+ self.imputer_ = SimpleImputer(
54
+ missing_values=self.missing_values,
55
+ strategy=self.imputation_strategy,
56
+ fill_value=self.fill_value,
57
+ ).set_output(transform="pandas")
58
+ self.imputer_._validate_params()
45
59
 
46
60
  def fit(self, x, y=None):
47
61
  """Fit the imputer on the input data."""
@@ -56,23 +70,13 @@ class MissingValuesTransformer:
56
70
  is_column_null = x.isnull().all(axis="index")
57
71
  self.non_null_feature_names = list(x.columns[~is_column_null])
58
72
 
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
73
  # Imputers do not support labels
72
- self.imputer_.fit(X=x, y=None)
74
+ self.imputer_.fit(X=x[self.non_null_feature_names], y=None)
75
+ self.is_fitted_ = True
73
76
 
74
77
  def transform(self, x) -> pd.DataFrame:
75
78
  """Transform the input data by imputing missing values."""
79
+ check_is_fitted(self)
76
80
  _ = check_array(x, force_all_finite="allow-nan")
77
81
  if not isinstance(x, pd.DataFrame):
78
82
  x = pd.DataFrame(np.asarray(x))
@@ -231,7 +231,7 @@ class LinearQuantileOpenstfRegressor(OpenstfRegressor, RegressorMixin):
231
231
  return np.array(
232
232
  [
233
233
  reg_feature_importances_dict.get(c, 0)
234
- for c in self.imputer_.in_feature_names
234
+ for c in self.imputer_.non_null_feature_names
235
235
  ]
236
236
  )
237
237
 
@@ -1,6 +1,10 @@
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
+ from typing import Optional
5
+
6
+ import numpy as np
7
+ from sklearn.base import RegressorMixin
4
8
 
5
9
  from xgboost import XGBRegressor
6
10
 
@@ -27,3 +31,22 @@ class XGBOpenstfRegressor(XGBRegressor, OpenstfRegressor):
27
31
  "gain_importance_name": "total_gain",
28
32
  "weight_importance_name": "weight",
29
33
  }
34
+
35
+ def fit(
36
+ self,
37
+ x: np.array,
38
+ y: np.array,
39
+ *,
40
+ early_stopping_rounds: Optional[int] = None,
41
+ callbacks: Optional[list] = None,
42
+ eval_metric: Optional[str] = None,
43
+ **kwargs
44
+ ):
45
+ if early_stopping_rounds is not None:
46
+ self.set_params(early_stopping_rounds=early_stopping_rounds)
47
+ if callbacks is not None:
48
+ self.set_params(callbacks=callbacks)
49
+ if eval_metric is not None:
50
+ self.set_params(eval_metric=eval_metric)
51
+
52
+ super().fit(x, y, **kwargs)
@@ -97,7 +97,7 @@ def create_basecase_forecast_task(
97
97
  context.database.write_forecast(basecase_forecast, t_ahead_series=True)
98
98
 
99
99
 
100
- def main(config: object = None, database: object = None):
100
+ def main(config: object = None, database: object = None, **kwargs):
101
101
  taskname = Path(__file__).name.replace(".py", "")
102
102
 
103
103
  if database is None or config is None:
@@ -110,7 +110,7 @@ def main(config: object = None, database: object = None):
110
110
  model_type = ["xgb", "xgb_quantile", "lgb"]
111
111
 
112
112
  PredictionJobLoop(context, model_type=model_type).map(
113
- create_basecase_forecast_task, context
113
+ create_basecase_forecast_task, context, **kwargs
114
114
  )
115
115
 
116
116
 
@@ -140,7 +140,7 @@ def create_components_forecast_task(
140
140
  )
141
141
 
142
142
 
143
- def main(config: object = None, database: object = None):
143
+ def main(config: object = None, database: object = None, **kwargs):
144
144
  taskname = Path(__file__).name.replace(".py", "")
145
145
 
146
146
  if database is None or config is None:
@@ -155,7 +155,7 @@ def main(config: object = None, database: object = None):
155
155
  PredictionJobLoop(
156
156
  context,
157
157
  model_type=model_type,
158
- ).map(create_components_forecast_task, context)
158
+ ).map(create_components_forecast_task, context, **kwargs)
159
159
 
160
160
 
161
161
  if __name__ == "__main__":
@@ -118,7 +118,7 @@ def create_forecast_task(
118
118
  context.database.write_forecast(forecast, t_ahead_series=True)
119
119
 
120
120
 
121
- def main(model_type=None, config=None, database=None):
121
+ def main(model_type=None, config=None, database=None, **kwargs):
122
122
  taskname = Path(__file__).name.replace(".py", "")
123
123
 
124
124
  if database is None or config is None:
@@ -132,7 +132,7 @@ def main(model_type=None, config=None, database=None):
132
132
  model_type = [ml.value for ml in MLModelType]
133
133
 
134
134
  PredictionJobLoop(context, model_type=model_type).map(
135
- create_forecast_task, context
135
+ create_forecast_task, context, **kwargs
136
136
  )
137
137
 
138
138
 
@@ -216,7 +216,7 @@ def fides(data: pd.DataFrame, all_forecasts: bool = False):
216
216
  return forecast
217
217
 
218
218
 
219
- def main(config=None, database=None):
219
+ def main(config=None, database=None, **kwargs):
220
220
  taskname = Path(__file__).name.replace(".py", "")
221
221
 
222
222
  if database is None or config is None:
@@ -245,7 +245,7 @@ def main(config=None, database=None):
245
245
  )
246
246
 
247
247
  PredictionJobLoop(context, prediction_jobs=prediction_jobs).map(
248
- make_solar_prediction_pj, context
248
+ make_solar_prediction_pj, context, kwargs=kwargs
249
249
  )
250
250
 
251
251
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: openstef
3
- Version: 3.4.31
3
+ Version: 3.4.33
4
4
  Summary: Open short term energy forecaster
5
5
  Home-page: https://github.com/OpenSTEF/openstef
6
6
  Author: Alliander N.V
@@ -15,25 +15,25 @@ Classifier: Programming Language :: Python :: 3.10
15
15
  Requires-Python: >=3.9.0
16
16
  Description-Content-Type: text/markdown
17
17
  License-File: LICENSE
18
- Requires-Dist: holidays ==0.21
19
- Requires-Dist: joblib ==1.3.2
20
- Requires-Dist: lightgbm ~=3.3
21
- Requires-Dist: matplotlib ~=3.7
22
- Requires-Dist: mlflow ~=2.3
23
- Requires-Dist: networkx ~=3.1
24
- Requires-Dist: optuna ~=3.1
25
- Requires-Dist: optuna-integration ~=3.6
26
- Requires-Dist: pandas ~=2.2.0
27
- Requires-Dist: plotly ~=5.18
28
- Requires-Dist: pvlib ==0.9.4
29
- Requires-Dist: pydantic ~=2.4
30
- Requires-Dist: pydantic-settings ~=2.3
31
- Requires-Dist: pymsteams ~=0.2.2
32
- Requires-Dist: scikit-learn ~=1.3
33
- Requires-Dist: scipy ~=1.10
34
- Requires-Dist: statsmodels <1.0.0,>=0.13.5
35
- Requires-Dist: structlog <25,>=23.1
36
- Requires-Dist: xgboost ~=2.0
18
+ Requires-Dist: holidays==0.21
19
+ Requires-Dist: joblib==1.3.2
20
+ Requires-Dist: lightgbm~=3.3
21
+ Requires-Dist: matplotlib~=3.7
22
+ Requires-Dist: mlflow~=2.3
23
+ Requires-Dist: networkx~=3.1
24
+ Requires-Dist: optuna~=3.1
25
+ Requires-Dist: optuna-integration~=3.6
26
+ Requires-Dist: pandas~=2.2.0
27
+ Requires-Dist: plotly~=5.18
28
+ Requires-Dist: pvlib==0.9.4
29
+ Requires-Dist: pydantic~=2.4
30
+ Requires-Dist: pydantic-settings~=2.3
31
+ Requires-Dist: pymsteams~=0.2.2
32
+ Requires-Dist: scikit-learn~=1.3
33
+ Requires-Dist: scipy~=1.10
34
+ Requires-Dist: statsmodels<1.0.0,>=0.13.5
35
+ Requires-Dist: structlog<25,>=23.1
36
+ Requires-Dist: xgboost~=2.0
37
37
 
38
38
  <!--
39
39
  SPDX-FileCopyrightText: 2017-2023 Contributors to the OpenSTEF project <korte.termijn.prognoses@alliander.com>
@@ -8,6 +8,10 @@ openstef/data/dutch_holidays_2020-2022.csv,sha256=pS-CjE0igYXd-2dG-MlqyvR2fgYgXk
8
8
  openstef/data/dutch_holidays_2020-2022.csv.license,sha256=AxxHusqwIXU5RHl5ZMU65LyXmgtbj6QlcnFaOEN4kEE,145
9
9
  openstef/data/pv_single_coefs.csv,sha256=jadIEYdHvl1lnV_06X_FASkJZ6C3Hecs5xZnH1gPMvI,24779
10
10
  openstef/data/pv_single_coefs.csv.license,sha256=AxxHusqwIXU5RHl5ZMU65LyXmgtbj6QlcnFaOEN4kEE,145
11
+ openstef/data/dazls_model_3.4.24/dazls_stored_3.4.24_baseline_model.z,sha256=2HEXuEvt5BMZMcDPiMfRiABgDQ698H_eM410XREIQK0,1293
12
+ openstef/data/dazls_model_3.4.24/dazls_stored_3.4.24_baseline_model.z.license,sha256=AxxHusqwIXU5RHl5ZMU65LyXmgtbj6QlcnFaOEN4kEE,145
13
+ openstef/data/dazls_model_3.4.24/dazls_stored_3.4.24_model_card.md,sha256=KJ8S8jg2k_aL1pCK_b3wOLMZqGdDALa4in73c4Am8gY,539
14
+ openstef/data/dazls_model_3.4.24/dazls_stored_3.4.24_model_card.md.license,sha256=AxxHusqwIXU5RHl5ZMU65LyXmgtbj6QlcnFaOEN4kEE,145
11
15
  openstef/data_classes/__init__.py,sha256=bIyGTSA4V5VoOLTwdaiJJAnozmpSzvQooVYlsf8H4eU,163
12
16
  openstef/data_classes/data_prep.py,sha256=gRSL7UiHvZis8m8z7VoTCZc0Ccffhef5_hmSyApnqK0,3417
13
17
  openstef/data_classes/model_specifications.py,sha256=Uod1W3QzhRqVLb6zvXwxh9wRL3EHCzSvX0oDNd28cFk,1197
@@ -21,7 +25,7 @@ openstef/feature_engineering/feature_applicator.py,sha256=DR7jayrEMlra4BFL1Ps5WV
21
25
  openstef/feature_engineering/general.py,sha256=tgU4_1stag9jJmaQAfWCMhfBscznVuQvW5hPK_z9_9g,4438
22
26
  openstef/feature_engineering/holiday_features.py,sha256=3Ff4Lkm26h8wJVoBplUewt4HfsvOUS9zj0x0MxewIm8,7842
23
27
  openstef/feature_engineering/lag_features.py,sha256=Dr6qS8UhdgEHPZZSe-w6ibtjl_lcbcQohhqdZN9fqEU,5652
24
- openstef/feature_engineering/missing_values_transformer.py,sha256=pKz_vRZRzfUNBw9Z-mF2AXRPeCzKbTha2gPb73bpkdw,3381
28
+ openstef/feature_engineering/missing_values_transformer.py,sha256=M5FNzpGubgAO-VoHoKpTlp6vLt6DlXt8lEYa96g7IMg,3565
25
29
  openstef/feature_engineering/weather_features.py,sha256=Lr9DItyHvJ2CpWQ1r6A83tJKtR2k_Wwn32FdFTGblO0,15750
26
30
  openstef/metrics/__init__.py,sha256=bIyGTSA4V5VoOLTwdaiJJAnozmpSzvQooVYlsf8H4eU,163
27
31
  openstef/metrics/figure.py,sha256=KDoezYem9wdS13kUx7M7FOy-4u88Sg3OX1DuhNT6kgQ,9751
@@ -46,9 +50,9 @@ openstef/model/regressors/dazls.py,sha256=Xt89yFHjkwpIUTkkhPmPZ74F8_tht_XV88INuP
46
50
  openstef/model/regressors/flatliner.py,sha256=J9p872FtobG49oMbc6mpl43TuEPt7DPSx8ZOeF6So-M,3017
47
51
  openstef/model/regressors/lgbm.py,sha256=zCdn1euEdSFxYJzH8XqQFFnb6R4JVUnmineKjX_Gy-g,800
48
52
  openstef/model/regressors/linear.py,sha256=uOvZMLGZH_9nXfmS5honCMfyVeyGXP1Cza9A_BdXlVw,3665
49
- openstef/model/regressors/linear_quantile.py,sha256=N-cia8aba39Th6BzOdtcESLuxhY9YtSGaOYIc6STgag,7830
53
+ openstef/model/regressors/linear_quantile.py,sha256=oYr5scc1k9wInPD0v6JBe1VgtsEKQycNvEzX5BWHaN0,7836
50
54
  openstef/model/regressors/regressor.py,sha256=uJcx59AyCPE9f_yPcAQ59h2ZS7eNsDpIHJrladKvHIw,3461
51
- openstef/model/regressors/xgb.py,sha256=HggA1U10srzdysjV560BMMX66kfaxCKAnOZB3JyyT_Y,808
55
+ openstef/model/regressors/xgb.py,sha256=SH-UiYJtMbfmRBK6738dU0ZRfYfzNynnikwbxINCE7Q,1467
52
56
  openstef/model/regressors/xgb_multioutput_quantile.py,sha256=xWzA7tymC_o-F1OS3I7vUKf9zP6RR1ZglEeY4NAgjU0,9146
53
57
  openstef/model/regressors/xgb_quantile.py,sha256=PzKIxqN_CnEPFmzXACNuzLSmZSHbooTuiJ5ckJ9vh_E,7805
54
58
  openstef/model_selection/__init__.py,sha256=bIyGTSA4V5VoOLTwdaiJJAnozmpSzvQooVYlsf8H4eU,163
@@ -70,10 +74,10 @@ openstef/preprocessing/__init__.py,sha256=bIyGTSA4V5VoOLTwdaiJJAnozmpSzvQooVYlsf
70
74
  openstef/preprocessing/preprocessing.py,sha256=bM_cSSSb2vGTD79RGzUrI6KoELbzlCyJwc7jqQGNEsE,1454
71
75
  openstef/tasks/__init__.py,sha256=bIyGTSA4V5VoOLTwdaiJJAnozmpSzvQooVYlsf8H4eU,163
72
76
  openstef/tasks/calculate_kpi.py,sha256=78DuK30ohWIHuc6oneRXalcNMXQ5mzy2qDr9xsPdSQs,11882
73
- openstef/tasks/create_basecase_forecast.py,sha256=Gk4Lsdh_wbGWx3rsJFHSu8akpckAjL92D_NUMFom-JA,4193
74
- openstef/tasks/create_components_forecast.py,sha256=j4m9AGjnMDx23FmsaZGPYn9rBMHsRd_h-m1RAfhF8to,6139
75
- openstef/tasks/create_forecast.py,sha256=NWd2fdbZ9CKDi190v7PF14IUdz6pyME2A-ssRNDdaYs,5750
76
- openstef/tasks/create_solar_forecast.py,sha256=bTr7NThTF6Yj405qAqRaJmlBUrL7HATqVVzsi9hMdMw,15049
77
+ openstef/tasks/create_basecase_forecast.py,sha256=rexAt6jGbW3YTXvDo606rzJvYETCoLVYCsBRihZas9U,4213
78
+ openstef/tasks/create_components_forecast.py,sha256=uhRjkvEdrbhQCw758UMVmVu-hU3YwxfnhM-Yj2ITQRg,6159
79
+ openstef/tasks/create_forecast.py,sha256=Q-1-0mSQYAzF48e0EAvAd30xyHXE4zJ2b47DF-LewnE,5770
80
+ openstef/tasks/create_solar_forecast.py,sha256=D5wBlsGJ-HI-wqDlOgg0NSwH7L6poSmz5x5xMCUPndw,15074
77
81
  openstef/tasks/create_wind_forecast.py,sha256=RhshkmNSyFWx4Y6yQn02GzHjWTREbN5A5GAeWv0JpcE,2907
78
82
  openstef/tasks/optimize_hyperparameters.py,sha256=s-z8YQJF6Lf3DdYgKHEpAdlbFJ3a-0Gj0Ahsqj1DErc,4758
79
83
  openstef/tasks/split_forecast.py,sha256=1MBi1kKYR6R3H-NMo4At_0SdpVamWnT5sUXffRX84dI,9327
@@ -84,8 +88,8 @@ openstef/tasks/utils/predictionjobloop.py,sha256=Ysy3zF5lzPMz_asYDKeF5m0qgVT3tCt
84
88
  openstef/tasks/utils/taskcontext.py,sha256=L9K14ycwgVxbIVUjH2DIn_QWbnu-OfxcGtQ1K9T6sus,5630
85
89
  openstef/validation/__init__.py,sha256=bIyGTSA4V5VoOLTwdaiJJAnozmpSzvQooVYlsf8H4eU,163
86
90
  openstef/validation/validation.py,sha256=628xaDbAm8B4AYtFOAn8_SXLjejNfULGCfX3hVf_mU0,11119
87
- openstef-3.4.31.dist-info/LICENSE,sha256=7Pm2fWFFHHUG5lDHed1vl5CjzxObIXQglnYsEdtjo_k,14907
88
- openstef-3.4.31.dist-info/METADATA,sha256=4un9Ku2wTVzvc51sn307_2KafMpW8HedR_dd2Wou82k,7399
89
- openstef-3.4.31.dist-info/WHEEL,sha256=Z4pYXqR_rTB7OWNDYFOm1qRk0RX6GFP2o8LgvP453Hk,91
90
- openstef-3.4.31.dist-info/top_level.txt,sha256=kD0H4PqrQoncZ957FvqwfBxa89kTrun4Z_RAPs_HhLs,9
91
- openstef-3.4.31.dist-info/RECORD,,
91
+ openstef-3.4.33.dist-info/LICENSE,sha256=7Pm2fWFFHHUG5lDHed1vl5CjzxObIXQglnYsEdtjo_k,14907
92
+ openstef-3.4.33.dist-info/METADATA,sha256=IwbncY0fUkH__KTCUOtudllxgf4xjgsYwG838kebfgI,7380
93
+ openstef-3.4.33.dist-info/WHEEL,sha256=UvcQYKBHoFqaQd6LKyqHw9fxEolWLQnlzP0h_LgJAfI,91
94
+ openstef-3.4.33.dist-info/top_level.txt,sha256=kD0H4PqrQoncZ957FvqwfBxa89kTrun4Z_RAPs_HhLs,9
95
+ openstef-3.4.33.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (70.3.0)
2
+ Generator: setuptools (74.0.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5