openstef 3.2.70__tar.gz → 3.2.71__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.
Files changed (96) hide show
  1. {openstef-3.2.70 → openstef-3.2.71}/PKG-INFO +1 -1
  2. {openstef-3.2.70 → openstef-3.2.71}/openstef/model/objective.py +6 -1
  3. {openstef-3.2.70 → openstef-3.2.71}/openstef/model_selection/model_selection.py +14 -9
  4. {openstef-3.2.70 → openstef-3.2.71}/openstef/pipeline/train_create_forecast_backtest.py +6 -2
  5. {openstef-3.2.70 → openstef-3.2.71}/openstef/pipeline/train_model.py +19 -7
  6. {openstef-3.2.70 → openstef-3.2.71}/openstef.egg-info/PKG-INFO +1 -1
  7. {openstef-3.2.70 → openstef-3.2.71}/setup.py +1 -1
  8. {openstef-3.2.70 → openstef-3.2.71}/LICENSE +0 -0
  9. {openstef-3.2.70 → openstef-3.2.71}/README.md +0 -0
  10. {openstef-3.2.70 → openstef-3.2.71}/openstef/__init__.py +0 -0
  11. {openstef-3.2.70 → openstef-3.2.71}/openstef/__main__.py +0 -0
  12. {openstef-3.2.70 → openstef-3.2.71}/openstef/data/dazls_stored.sav +0 -0
  13. {openstef-3.2.70 → openstef-3.2.71}/openstef/data/dazls_stored.sav.license +0 -0
  14. {openstef-3.2.70 → openstef-3.2.71}/openstef/data/dutch_holidays_2020-2022.csv +0 -0
  15. {openstef-3.2.70 → openstef-3.2.71}/openstef/data/dutch_holidays_2020-2022.csv.license +0 -0
  16. {openstef-3.2.70 → openstef-3.2.71}/openstef/data/pv_single_coefs.csv +0 -0
  17. {openstef-3.2.70 → openstef-3.2.71}/openstef/data/pv_single_coefs.csv.license +0 -0
  18. {openstef-3.2.70 → openstef-3.2.71}/openstef/data_classes/__init__.py +0 -0
  19. {openstef-3.2.70 → openstef-3.2.71}/openstef/data_classes/data_prep.py +0 -0
  20. {openstef-3.2.70 → openstef-3.2.71}/openstef/data_classes/model_specifications.py +0 -0
  21. {openstef-3.2.70 → openstef-3.2.71}/openstef/data_classes/prediction_job.py +0 -0
  22. {openstef-3.2.70 → openstef-3.2.71}/openstef/data_classes/split_function.py +0 -0
  23. {openstef-3.2.70 → openstef-3.2.71}/openstef/enums.py +0 -0
  24. {openstef-3.2.70 → openstef-3.2.71}/openstef/exceptions.py +0 -0
  25. {openstef-3.2.70 → openstef-3.2.71}/openstef/feature_engineering/__init__.py +0 -0
  26. {openstef-3.2.70 → openstef-3.2.71}/openstef/feature_engineering/apply_features.py +0 -0
  27. {openstef-3.2.70 → openstef-3.2.71}/openstef/feature_engineering/data_preparation.py +0 -0
  28. {openstef-3.2.70 → openstef-3.2.71}/openstef/feature_engineering/feature_adder.py +0 -0
  29. {openstef-3.2.70 → openstef-3.2.71}/openstef/feature_engineering/feature_applicator.py +0 -0
  30. {openstef-3.2.70 → openstef-3.2.71}/openstef/feature_engineering/general.py +0 -0
  31. {openstef-3.2.70 → openstef-3.2.71}/openstef/feature_engineering/historic_features.py +0 -0
  32. {openstef-3.2.70 → openstef-3.2.71}/openstef/feature_engineering/holiday_features.py +0 -0
  33. {openstef-3.2.70 → openstef-3.2.71}/openstef/feature_engineering/lag_features.py +0 -0
  34. {openstef-3.2.70 → openstef-3.2.71}/openstef/feature_engineering/weather_features.py +0 -0
  35. {openstef-3.2.70 → openstef-3.2.71}/openstef/metrics/__init__.py +0 -0
  36. {openstef-3.2.70 → openstef-3.2.71}/openstef/metrics/figure.py +0 -0
  37. {openstef-3.2.70 → openstef-3.2.71}/openstef/metrics/metrics.py +0 -0
  38. {openstef-3.2.70 → openstef-3.2.71}/openstef/metrics/reporter.py +0 -0
  39. {openstef-3.2.70 → openstef-3.2.71}/openstef/model/__init__.py +0 -0
  40. {openstef-3.2.70 → openstef-3.2.71}/openstef/model/basecase.py +0 -0
  41. {openstef-3.2.70 → openstef-3.2.71}/openstef/model/confidence_interval_applicator.py +0 -0
  42. {openstef-3.2.70 → openstef-3.2.71}/openstef/model/fallback.py +0 -0
  43. {openstef-3.2.70 → openstef-3.2.71}/openstef/model/metamodels/__init__.py +0 -0
  44. {openstef-3.2.70 → openstef-3.2.71}/openstef/model/metamodels/grouped_regressor.py +0 -0
  45. {openstef-3.2.70 → openstef-3.2.71}/openstef/model/metamodels/missing_values_handler.py +0 -0
  46. {openstef-3.2.70 → openstef-3.2.71}/openstef/model/model_creator.py +0 -0
  47. {openstef-3.2.70 → openstef-3.2.71}/openstef/model/objective_creator.py +0 -0
  48. {openstef-3.2.70 → openstef-3.2.71}/openstef/model/regressors/__init__.py +0 -0
  49. {openstef-3.2.70 → openstef-3.2.71}/openstef/model/regressors/arima.py +0 -0
  50. {openstef-3.2.70 → openstef-3.2.71}/openstef/model/regressors/custom_regressor.py +0 -0
  51. {openstef-3.2.70 → openstef-3.2.71}/openstef/model/regressors/dazls.py +0 -0
  52. {openstef-3.2.70 → openstef-3.2.71}/openstef/model/regressors/lgbm.py +0 -0
  53. {openstef-3.2.70 → openstef-3.2.71}/openstef/model/regressors/linear.py +0 -0
  54. {openstef-3.2.70 → openstef-3.2.71}/openstef/model/regressors/proloaf.py +0 -0
  55. {openstef-3.2.70 → openstef-3.2.71}/openstef/model/regressors/regressor.py +0 -0
  56. {openstef-3.2.70 → openstef-3.2.71}/openstef/model/regressors/xgb.py +0 -0
  57. {openstef-3.2.70 → openstef-3.2.71}/openstef/model/regressors/xgb_quantile.py +0 -0
  58. {openstef-3.2.70 → openstef-3.2.71}/openstef/model/serializer.py +0 -0
  59. {openstef-3.2.70 → openstef-3.2.71}/openstef/model/standard_deviation_generator.py +0 -0
  60. {openstef-3.2.70 → openstef-3.2.71}/openstef/model_selection/__init__.py +0 -0
  61. {openstef-3.2.70 → openstef-3.2.71}/openstef/monitoring/__init__.py +0 -0
  62. {openstef-3.2.70 → openstef-3.2.71}/openstef/monitoring/performance_meter.py +0 -0
  63. {openstef-3.2.70 → openstef-3.2.71}/openstef/monitoring/teams.py +0 -0
  64. {openstef-3.2.70 → openstef-3.2.71}/openstef/pipeline/__init__.py +0 -0
  65. {openstef-3.2.70 → openstef-3.2.71}/openstef/pipeline/create_basecase_forecast.py +0 -0
  66. {openstef-3.2.70 → openstef-3.2.71}/openstef/pipeline/create_component_forecast.py +0 -0
  67. {openstef-3.2.70 → openstef-3.2.71}/openstef/pipeline/create_forecast.py +0 -0
  68. {openstef-3.2.70 → openstef-3.2.71}/openstef/pipeline/optimize_hyperparameters.py +0 -0
  69. {openstef-3.2.70 → openstef-3.2.71}/openstef/pipeline/utils.py +0 -0
  70. {openstef-3.2.70 → openstef-3.2.71}/openstef/postprocessing/__init__.py +0 -0
  71. {openstef-3.2.70 → openstef-3.2.71}/openstef/postprocessing/postprocessing.py +0 -0
  72. {openstef-3.2.70 → openstef-3.2.71}/openstef/preprocessing/__init__.py +0 -0
  73. {openstef-3.2.70 → openstef-3.2.71}/openstef/preprocessing/preprocessing.py +0 -0
  74. {openstef-3.2.70 → openstef-3.2.71}/openstef/tasks/__init__.py +0 -0
  75. {openstef-3.2.70 → openstef-3.2.71}/openstef/tasks/calculate_kpi.py +0 -0
  76. {openstef-3.2.70 → openstef-3.2.71}/openstef/tasks/create_basecase_forecast.py +0 -0
  77. {openstef-3.2.70 → openstef-3.2.71}/openstef/tasks/create_components_forecast.py +0 -0
  78. {openstef-3.2.70 → openstef-3.2.71}/openstef/tasks/create_forecast.py +0 -0
  79. {openstef-3.2.70 → openstef-3.2.71}/openstef/tasks/create_solar_forecast.py +0 -0
  80. {openstef-3.2.70 → openstef-3.2.71}/openstef/tasks/create_wind_forecast.py +0 -0
  81. {openstef-3.2.70 → openstef-3.2.71}/openstef/tasks/optimize_hyperparameters.py +0 -0
  82. {openstef-3.2.70 → openstef-3.2.71}/openstef/tasks/run_tracy.py +0 -0
  83. {openstef-3.2.70 → openstef-3.2.71}/openstef/tasks/split_forecast.py +0 -0
  84. {openstef-3.2.70 → openstef-3.2.71}/openstef/tasks/train_model.py +0 -0
  85. {openstef-3.2.70 → openstef-3.2.71}/openstef/tasks/utils/__init__.py +0 -0
  86. {openstef-3.2.70 → openstef-3.2.71}/openstef/tasks/utils/dependencies.py +0 -0
  87. {openstef-3.2.70 → openstef-3.2.71}/openstef/tasks/utils/predictionjobloop.py +0 -0
  88. {openstef-3.2.70 → openstef-3.2.71}/openstef/tasks/utils/taskcontext.py +0 -0
  89. {openstef-3.2.70 → openstef-3.2.71}/openstef/validation/__init__.py +0 -0
  90. {openstef-3.2.70 → openstef-3.2.71}/openstef/validation/validation.py +0 -0
  91. {openstef-3.2.70 → openstef-3.2.71}/openstef.egg-info/SOURCES.txt +0 -0
  92. {openstef-3.2.70 → openstef-3.2.71}/openstef.egg-info/dependency_links.txt +0 -0
  93. {openstef-3.2.70 → openstef-3.2.71}/openstef.egg-info/requires.txt +0 -0
  94. {openstef-3.2.70 → openstef-3.2.71}/openstef.egg-info/top_level.txt +0 -0
  95. {openstef-3.2.70 → openstef-3.2.71}/pyproject.toml +0 -0
  96. {openstef-3.2.70 → openstef-3.2.71}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: openstef
3
- Version: 3.2.70
3
+ Version: 3.2.71
4
4
  Summary: Open short term energy forecaster
5
5
  Home-page: https://github.com/OpenSTEF/openstef
6
6
  Author: Alliander N.V
@@ -97,7 +97,12 @@ class RegressorObjective:
97
97
  "stratification_min_max": self.model_type != MLModelType.ProLoaf,
98
98
  "back_test": True,
99
99
  }
100
- (self.train_data, self.validation_data, self.test_data,) = self.split_func(
100
+ (
101
+ self.train_data,
102
+ self.validation_data,
103
+ self.test_data,
104
+ self.operational_score_data,
105
+ ) = self.split_func(
101
106
  self.input_data,
102
107
  test_fraction=self.test_fraction,
103
108
  validation_fraction=self.validation_fraction,
@@ -113,7 +113,7 @@ def split_data_train_validation_test(
113
113
  validation dataset. In an operational setting the following sequence is
114
114
  returned (when using stratification):
115
115
 
116
- Test >> Train >> Validation
116
+ Train >> Validation (and the test is the Train and Validation combined.)
117
117
 
118
118
  For a back test (indicated with argument "back_test") the following sequence
119
119
  is returned:
@@ -141,6 +141,7 @@ def split_data_train_validation_test(
141
141
  - Test data.
142
142
 
143
143
  """
144
+ test_fraction = test_fraction if back_test else 0
144
145
  train_fraction = 1 - (test_fraction + validation_fraction)
145
146
  if train_fraction < 0:
146
147
  raise ValueError(
@@ -172,10 +173,18 @@ def split_data_train_validation_test(
172
173
  start_date_test = end_date - np.round(number_indices * test_fraction) * delta
173
174
  test_data = data_[start_date_test:]
174
175
  train_val_data = data_[:start_date_test]
176
+ operational_score_data = (
177
+ pd.DataFrame()
178
+ ) # Empty because a backtest is no operational setting.
175
179
  else:
176
180
  start_date_val = start_date + np.round(number_indices * test_fraction) * delta
177
- test_data = data_[:start_date_val]
181
+ test_data = data_[
182
+ :start_date_val
183
+ ] # Empty as all data is used for training in an operational setting.
178
184
  train_val_data = data_[start_date_val:]
185
+ operational_score_data = data_.copy(deep=True).reset_index(
186
+ drop=True
187
+ ) # Used to check wether a new operationally train model is better than the old one.
179
188
 
180
189
  if stratification_min_max and (
181
190
  len(set(train_val_data.index.date)) >= min_days_for_stratification
@@ -248,11 +257,7 @@ def split_data_train_validation_test(
248
257
  validation_data = validation_data.sort_index()
249
258
  test_data = test_data.sort_index()
250
259
 
251
- return (
252
- train_data,
253
- validation_data,
254
- test_data,
255
- )
260
+ return (train_data, validation_data, test_data, operational_score_data)
256
261
 
257
262
 
258
263
  def backtest_split_default(
@@ -286,14 +291,14 @@ def backtest_split_default(
286
291
  for ifold in range(n_folds):
287
292
  test_data = data[data["random_fold"] == ifold].sort_index()
288
293
 
289
- (train_data, validation_data, _,) = split_data_train_validation_test(
294
+ (train_data, validation_data, _, _) = split_data_train_validation_test(
290
295
  data[data["random_fold"] != ifold].iloc[:, :-2],
291
296
  test_fraction=0,
292
297
  back_test=True,
293
298
  stratification_min_max=stratification_min_max,
294
299
  )
295
300
 
296
- yield train_data, validation_data, test_data.iloc[:, :-2]
301
+ yield train_data, validation_data, test_data.iloc[:, :-2], pd.DataFrame()
297
302
  else:
298
303
  yield split_data_train_validation_test(
299
304
  data,
@@ -82,10 +82,14 @@ def train_model_and_forecast_back_test(
82
82
  ) = zip(
83
83
  *(
84
84
  train_model_and_forecast_test_core(
85
- pj, modelspecs, train_data, validation_data, test_data
85
+ pj,
86
+ modelspecs,
87
+ train_data,
88
+ validation_data,
89
+ test_data,
86
90
  )
87
91
  + (train_data, validation_data, test_data)
88
- for train_data, validation_data, test_data in backtest_split_func(
92
+ for train_data, validation_data, test_data, _ in backtest_split_func(
89
93
  data_with_features, n_folds, **backtest_split_args
90
94
  )
91
95
  )
@@ -176,7 +176,14 @@ def train_model_pipeline_core(
176
176
  logger = structlog.get_logger(__name__)
177
177
 
178
178
  # Call common pipeline
179
- model, report, train_data, validation_data, test_data = train_pipeline_common(
179
+ (
180
+ model,
181
+ report,
182
+ train_data,
183
+ validation_data,
184
+ test_data,
185
+ operational_score_data,
186
+ ) = train_pipeline_common(
180
187
  pj,
181
188
  model_specs,
182
189
  input_data,
@@ -192,8 +199,8 @@ def train_model_pipeline_core(
192
199
  combined = combined.iloc[:, :-1]
193
200
 
194
201
  x_data, y_data = (
195
- combined.iloc[:, 1:-1],
196
- combined.iloc[:, 0],
202
+ operational_score_data.iloc[:, 1:-1],
203
+ operational_score_data.iloc[:, 0],
197
204
  )
198
205
 
199
206
  # Score method always returns R^2
@@ -260,7 +267,12 @@ def train_pipeline_common(
260
267
  horizons=horizons,
261
268
  )
262
269
 
263
- train_data, validation_data, test_data = train_pipeline_step_split_data(
270
+ (
271
+ train_data,
272
+ validation_data,
273
+ test_data,
274
+ operational_score_data,
275
+ ) = train_pipeline_step_split_data(
264
276
  data_with_features=data_with_features,
265
277
  pj=pj,
266
278
  test_fraction=test_fraction,
@@ -284,7 +296,7 @@ def train_pipeline_common(
284
296
  validation_data["forecast"] = model.predict(validation_data.iloc[:, 1:-1])
285
297
  test_data["forecast"] = model.predict(test_data.iloc[:, 1:-1])
286
298
 
287
- return model, report, train_data, validation_data, test_data
299
+ return model, report, train_data, validation_data, test_data, operational_score_data
288
300
 
289
301
 
290
302
  def train_pipeline_step_load_model(
@@ -515,7 +527,7 @@ def train_pipeline_step_split_data(
515
527
  required_arguments=["data", "test_fraction"]
516
528
  )
517
529
 
518
- train_data, validation_data, test_data = split_func(
530
+ train_data, validation_data, test_data, operational_score_data = split_func(
519
531
  data_with_features, test_fraction, **split_args
520
532
  )
521
533
 
@@ -523,4 +535,4 @@ def train_pipeline_step_split_data(
523
535
  if not test_data_predefined.empty:
524
536
  test_data = test_data_predefined
525
537
 
526
- return train_data, validation_data, test_data
538
+ return train_data, validation_data, test_data, operational_score_data
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: openstef
3
- Version: 3.2.70
3
+ Version: 3.2.71
4
4
  Summary: Open short term energy forecaster
5
5
  Home-page: https://github.com/OpenSTEF/openstef
6
6
  Author: Alliander N.V
@@ -29,7 +29,7 @@ def read_long_description_from_readme():
29
29
 
30
30
  setup(
31
31
  name="openstef",
32
- version="3.2.70",
32
+ version="3.2.71",
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(),
File without changes
File without changes
File without changes
File without changes
File without changes