openstef 3.4.78__tar.gz → 3.4.79__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 (117) hide show
  1. {openstef-3.4.78 → openstef-3.4.79}/PKG-INFO +1 -1
  2. {openstef-3.4.78 → openstef-3.4.79}/openstef/feature_engineering/holiday_features.py +34 -26
  3. {openstef-3.4.78 → openstef-3.4.79}/openstef/model/regressors/median.py +5 -3
  4. {openstef-3.4.78 → openstef-3.4.79}/openstef.egg-info/PKG-INFO +1 -1
  5. {openstef-3.4.78 → openstef-3.4.79}/setup.py +1 -1
  6. {openstef-3.4.78 → openstef-3.4.79}/LICENSE +0 -0
  7. {openstef-3.4.78 → openstef-3.4.79}/README.md +0 -0
  8. {openstef-3.4.78 → openstef-3.4.79}/openstef/__init__.py +0 -0
  9. {openstef-3.4.78 → openstef-3.4.79}/openstef/__main__.py +0 -0
  10. {openstef-3.4.78 → openstef-3.4.79}/openstef/app_settings.py +0 -0
  11. {openstef-3.4.78 → openstef-3.4.79}/openstef/data/NL_terrestrial_radiation.csv +0 -0
  12. {openstef-3.4.78 → openstef-3.4.79}/openstef/data/NL_terrestrial_radiation.csv.license +0 -0
  13. {openstef-3.4.78 → openstef-3.4.79}/openstef/data/dazls_model_3.4.24/dazls_stored_3.4.24_baseline_model.z +0 -0
  14. {openstef-3.4.78 → openstef-3.4.79}/openstef/data/dazls_model_3.4.24/dazls_stored_3.4.24_baseline_model.z.license +0 -0
  15. {openstef-3.4.78 → openstef-3.4.79}/openstef/data/dazls_model_3.4.24/dazls_stored_3.4.24_model_card.md +0 -0
  16. {openstef-3.4.78 → openstef-3.4.79}/openstef/data/dazls_model_3.4.24/dazls_stored_3.4.24_model_card.md.license +0 -0
  17. {openstef-3.4.78 → openstef-3.4.79}/openstef/data/dutch_holidays.csv +0 -0
  18. {openstef-3.4.78 → openstef-3.4.79}/openstef/data/dutch_holidays.csv.license +0 -0
  19. {openstef-3.4.78 → openstef-3.4.79}/openstef/data/pv_single_coefs.csv +0 -0
  20. {openstef-3.4.78 → openstef-3.4.79}/openstef/data/pv_single_coefs.csv.license +0 -0
  21. {openstef-3.4.78 → openstef-3.4.79}/openstef/data_classes/__init__.py +0 -0
  22. {openstef-3.4.78 → openstef-3.4.79}/openstef/data_classes/data_prep.py +0 -0
  23. {openstef-3.4.78 → openstef-3.4.79}/openstef/data_classes/model_specifications.py +0 -0
  24. {openstef-3.4.78 → openstef-3.4.79}/openstef/data_classes/prediction_job.py +0 -0
  25. {openstef-3.4.78 → openstef-3.4.79}/openstef/data_classes/split_function.py +0 -0
  26. {openstef-3.4.78 → openstef-3.4.79}/openstef/enums.py +0 -0
  27. {openstef-3.4.78 → openstef-3.4.79}/openstef/exceptions.py +0 -0
  28. {openstef-3.4.78 → openstef-3.4.79}/openstef/feature_engineering/__init__.py +0 -0
  29. {openstef-3.4.78 → openstef-3.4.79}/openstef/feature_engineering/apply_features.py +0 -0
  30. {openstef-3.4.78 → openstef-3.4.79}/openstef/feature_engineering/bidding_zone_to_country_mapping.py +0 -0
  31. {openstef-3.4.78 → openstef-3.4.79}/openstef/feature_engineering/cyclic_features.py +0 -0
  32. {openstef-3.4.78 → openstef-3.4.79}/openstef/feature_engineering/data_preparation.py +0 -0
  33. {openstef-3.4.78 → openstef-3.4.79}/openstef/feature_engineering/feature_adder.py +0 -0
  34. {openstef-3.4.78 → openstef-3.4.79}/openstef/feature_engineering/feature_applicator.py +0 -0
  35. {openstef-3.4.78 → openstef-3.4.79}/openstef/feature_engineering/general.py +0 -0
  36. {openstef-3.4.78 → openstef-3.4.79}/openstef/feature_engineering/lag_features.py +0 -0
  37. {openstef-3.4.78 → openstef-3.4.79}/openstef/feature_engineering/missing_values_transformer.py +0 -0
  38. {openstef-3.4.78 → openstef-3.4.79}/openstef/feature_engineering/rolling_features.py +0 -0
  39. {openstef-3.4.78 → openstef-3.4.79}/openstef/feature_engineering/weather_features.py +0 -0
  40. {openstef-3.4.78 → openstef-3.4.79}/openstef/logging/__init__.py +0 -0
  41. {openstef-3.4.78 → openstef-3.4.79}/openstef/logging/base_logger.py +0 -0
  42. {openstef-3.4.78 → openstef-3.4.79}/openstef/logging/logger_factory.py +0 -0
  43. {openstef-3.4.78 → openstef-3.4.79}/openstef/logging/logger_types.py +0 -0
  44. {openstef-3.4.78 → openstef-3.4.79}/openstef/logging/standard_logger.py +0 -0
  45. {openstef-3.4.78 → openstef-3.4.79}/openstef/logging/structlog_logger.py +0 -0
  46. {openstef-3.4.78 → openstef-3.4.79}/openstef/metrics/__init__.py +0 -0
  47. {openstef-3.4.78 → openstef-3.4.79}/openstef/metrics/figure.py +0 -0
  48. {openstef-3.4.78 → openstef-3.4.79}/openstef/metrics/metrics.py +0 -0
  49. {openstef-3.4.78 → openstef-3.4.79}/openstef/metrics/reporter.py +0 -0
  50. {openstef-3.4.78 → openstef-3.4.79}/openstef/model/__init__.py +0 -0
  51. {openstef-3.4.78 → openstef-3.4.79}/openstef/model/basecase.py +0 -0
  52. {openstef-3.4.78 → openstef-3.4.79}/openstef/model/confidence_interval_applicator.py +0 -0
  53. {openstef-3.4.78 → openstef-3.4.79}/openstef/model/fallback.py +0 -0
  54. {openstef-3.4.78 → openstef-3.4.79}/openstef/model/metamodels/__init__.py +0 -0
  55. {openstef-3.4.78 → openstef-3.4.79}/openstef/model/metamodels/feature_clipper.py +0 -0
  56. {openstef-3.4.78 → openstef-3.4.79}/openstef/model/metamodels/grouped_regressor.py +0 -0
  57. {openstef-3.4.78 → openstef-3.4.79}/openstef/model/metamodels/missing_values_handler.py +0 -0
  58. {openstef-3.4.78 → openstef-3.4.79}/openstef/model/model_creator.py +0 -0
  59. {openstef-3.4.78 → openstef-3.4.79}/openstef/model/objective.py +0 -0
  60. {openstef-3.4.78 → openstef-3.4.79}/openstef/model/objective_creator.py +0 -0
  61. {openstef-3.4.78 → openstef-3.4.79}/openstef/model/regressors/__init__.py +0 -0
  62. {openstef-3.4.78 → openstef-3.4.79}/openstef/model/regressors/arima.py +0 -0
  63. {openstef-3.4.78 → openstef-3.4.79}/openstef/model/regressors/custom_regressor.py +0 -0
  64. {openstef-3.4.78 → openstef-3.4.79}/openstef/model/regressors/dazls.py +0 -0
  65. {openstef-3.4.78 → openstef-3.4.79}/openstef/model/regressors/flatliner.py +0 -0
  66. {openstef-3.4.78 → openstef-3.4.79}/openstef/model/regressors/gblinear_quantile.py +0 -0
  67. {openstef-3.4.78 → openstef-3.4.79}/openstef/model/regressors/lgbm.py +0 -0
  68. {openstef-3.4.78 → openstef-3.4.79}/openstef/model/regressors/linear.py +0 -0
  69. {openstef-3.4.78 → openstef-3.4.79}/openstef/model/regressors/linear_quantile.py +0 -0
  70. {openstef-3.4.78 → openstef-3.4.79}/openstef/model/regressors/regressor.py +0 -0
  71. {openstef-3.4.78 → openstef-3.4.79}/openstef/model/regressors/xgb.py +0 -0
  72. {openstef-3.4.78 → openstef-3.4.79}/openstef/model/regressors/xgb_multioutput_quantile.py +0 -0
  73. {openstef-3.4.78 → openstef-3.4.79}/openstef/model/regressors/xgb_quantile.py +0 -0
  74. {openstef-3.4.78 → openstef-3.4.79}/openstef/model/serializer.py +0 -0
  75. {openstef-3.4.78 → openstef-3.4.79}/openstef/model/standard_deviation_generator.py +0 -0
  76. {openstef-3.4.78 → openstef-3.4.79}/openstef/model_selection/__init__.py +0 -0
  77. {openstef-3.4.78 → openstef-3.4.79}/openstef/model_selection/model_selection.py +0 -0
  78. {openstef-3.4.78 → openstef-3.4.79}/openstef/monitoring/__init__.py +0 -0
  79. {openstef-3.4.78 → openstef-3.4.79}/openstef/monitoring/performance_meter.py +0 -0
  80. {openstef-3.4.78 → openstef-3.4.79}/openstef/monitoring/teams.py +0 -0
  81. {openstef-3.4.78 → openstef-3.4.79}/openstef/pipeline/__init__.py +0 -0
  82. {openstef-3.4.78 → openstef-3.4.79}/openstef/pipeline/create_basecase_forecast.py +0 -0
  83. {openstef-3.4.78 → openstef-3.4.79}/openstef/pipeline/create_component_forecast.py +0 -0
  84. {openstef-3.4.78 → openstef-3.4.79}/openstef/pipeline/create_forecast.py +0 -0
  85. {openstef-3.4.78 → openstef-3.4.79}/openstef/pipeline/optimize_hyperparameters.py +0 -0
  86. {openstef-3.4.78 → openstef-3.4.79}/openstef/pipeline/train_create_forecast_backtest.py +0 -0
  87. {openstef-3.4.78 → openstef-3.4.79}/openstef/pipeline/train_model.py +0 -0
  88. {openstef-3.4.78 → openstef-3.4.79}/openstef/pipeline/utils.py +0 -0
  89. {openstef-3.4.78 → openstef-3.4.79}/openstef/plotting/__init__.py +0 -0
  90. {openstef-3.4.78 → openstef-3.4.79}/openstef/plotting/load_forecast_plotter.py +0 -0
  91. {openstef-3.4.78 → openstef-3.4.79}/openstef/postprocessing/__init__.py +0 -0
  92. {openstef-3.4.78 → openstef-3.4.79}/openstef/postprocessing/postprocessing.py +0 -0
  93. {openstef-3.4.78 → openstef-3.4.79}/openstef/preprocessing/__init__.py +0 -0
  94. {openstef-3.4.78 → openstef-3.4.79}/openstef/preprocessing/preprocessing.py +0 -0
  95. {openstef-3.4.78 → openstef-3.4.79}/openstef/settings.py +0 -0
  96. {openstef-3.4.78 → openstef-3.4.79}/openstef/tasks/__init__.py +0 -0
  97. {openstef-3.4.78 → openstef-3.4.79}/openstef/tasks/calculate_kpi.py +0 -0
  98. {openstef-3.4.78 → openstef-3.4.79}/openstef/tasks/create_basecase_forecast.py +0 -0
  99. {openstef-3.4.78 → openstef-3.4.79}/openstef/tasks/create_components_forecast.py +0 -0
  100. {openstef-3.4.78 → openstef-3.4.79}/openstef/tasks/create_forecast.py +0 -0
  101. {openstef-3.4.78 → openstef-3.4.79}/openstef/tasks/create_solar_forecast.py +0 -0
  102. {openstef-3.4.78 → openstef-3.4.79}/openstef/tasks/create_wind_forecast.py +0 -0
  103. {openstef-3.4.78 → openstef-3.4.79}/openstef/tasks/optimize_hyperparameters.py +0 -0
  104. {openstef-3.4.78 → openstef-3.4.79}/openstef/tasks/split_forecast.py +0 -0
  105. {openstef-3.4.78 → openstef-3.4.79}/openstef/tasks/train_model.py +0 -0
  106. {openstef-3.4.78 → openstef-3.4.79}/openstef/tasks/utils/__init__.py +0 -0
  107. {openstef-3.4.78 → openstef-3.4.79}/openstef/tasks/utils/dependencies.py +0 -0
  108. {openstef-3.4.78 → openstef-3.4.79}/openstef/tasks/utils/predictionjobloop.py +0 -0
  109. {openstef-3.4.78 → openstef-3.4.79}/openstef/tasks/utils/taskcontext.py +0 -0
  110. {openstef-3.4.78 → openstef-3.4.79}/openstef/validation/__init__.py +0 -0
  111. {openstef-3.4.78 → openstef-3.4.79}/openstef/validation/validation.py +0 -0
  112. {openstef-3.4.78 → openstef-3.4.79}/openstef.egg-info/SOURCES.txt +0 -0
  113. {openstef-3.4.78 → openstef-3.4.79}/openstef.egg-info/dependency_links.txt +0 -0
  114. {openstef-3.4.78 → openstef-3.4.79}/openstef.egg-info/requires.txt +0 -0
  115. {openstef-3.4.78 → openstef-3.4.79}/openstef.egg-info/top_level.txt +0 -0
  116. {openstef-3.4.78 → openstef-3.4.79}/pyproject.toml +0 -0
  117. {openstef-3.4.78 → openstef-3.4.79}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: openstef
3
- Version: 3.4.78
3
+ Version: 3.4.79
4
4
  Summary: Open short term energy forecaster
5
5
  Home-page: https://github.com/OpenSTEF/openstef
6
6
  Author: Alliander N.V
@@ -1,8 +1,8 @@
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
- """This module contains all holiday related features."""
5
4
  from datetime import datetime, timedelta
5
+ import collections
6
6
 
7
7
  import holidays
8
8
  import numpy as np
@@ -26,7 +26,6 @@ def generate_holiday_feature_functions(
26
26
  2022-12-24 - 2023-01-08 is the 'Kerstvakantie'
27
27
  2022-10-15 - 2022-10-23 is the 'HerfstvakantieNoord'
28
28
 
29
-
30
29
  The holidays are based on a manually generated csv file.
31
30
  The information is collected using:
32
31
  https://www.schoolvakanties-nederland.nl/ and the python holiday function
@@ -44,7 +43,6 @@ def generate_holiday_feature_functions(
44
43
  - Pinksteren
45
44
  - Kerst
46
45
 
47
-
48
46
  The 'Brugdagen' are updated untill dec 2020. (Generated using agenda)
49
47
 
50
48
  Args:
@@ -83,23 +81,34 @@ def generate_holiday_feature_functions(
83
81
  )
84
82
  }
85
83
  )
84
+
86
85
  # Define empty list to keep track of bridgedays
87
86
  bridge_days = []
88
- # Loop over list of holidays names
87
+
88
+ # Group holiday dates by name
89
+ holiday_dates_by_name = collections.defaultdict(list)
89
90
  for date, holiday_name in sorted(country_holidays.items()):
90
- # Define function explicitely to mitigate 'late binding' problem
91
- def make_holiday_func(requested_date):
92
- return lambda x: np.isin(x.index.date, np.array([requested_date]))
91
+ holiday_dates_by_name[holiday_name].append(date)
93
92
 
94
- # Create lag function for each holiday
93
+ # Create one function per holiday name that checks all dates for that holiday
94
+ for holiday_name, dates in holiday_dates_by_name.items():
95
+ # Use a default argument to capture the dates at definition time
95
96
  holiday_functions.update(
96
- {"is_" + holiday_name.replace(" ", "_").lower(): make_holiday_func(date)}
97
+ {
98
+ "is_"
99
+ + holiday_name.replace(
100
+ " ", "_"
101
+ ).lower(): lambda x, dates_local=dates: np.isin(
102
+ x.index.date, np.array(dates_local)
103
+ )
104
+ }
97
105
  )
98
106
 
99
- # Check for bridge day
100
- holiday_functions, bridge_days = check_for_bridge_day(
101
- date, holiday_name, country_code, years, holiday_functions, bridge_days
102
- )
107
+ # Check for bridge days for each date of this holiday
108
+ for date in dates:
109
+ holiday_functions, bridge_days = check_for_bridge_day(
110
+ date, holiday_name, country_code, years, holiday_functions, bridge_days
111
+ )
103
112
 
104
113
  # Add feature function that includes all bridgedays
105
114
  holiday_functions.update(
@@ -108,7 +117,7 @@ def generate_holiday_feature_functions(
108
117
 
109
118
  # Add school holidays if country is NL
110
119
  if country_code == "NL":
111
- # Manully generated csv including all dutch schoolholidays for different regions
120
+ # Manually generated csv including all dutch schoolholidays for different regions
112
121
  df_holidays = pd.read_csv(path_to_school_holidays_csv, index_col=None)
113
122
  df_holidays["datum"] = pd.to_datetime(df_holidays.datum).apply(
114
123
  lambda x: x.date()
@@ -125,19 +134,17 @@ def generate_holiday_feature_functions(
125
134
 
126
135
  # Loop over list of holidays names
127
136
  for holiday_name in list(set(df_holidays.name)):
128
- # Define function explicitely to mitigate 'late binding' problem
129
- def make_holiday_func(holidayname=holiday_name):
130
- return lambda x: np.isin(
131
- x.index.date,
132
- df_holidays.datum[df_holidays.name == holidayname].values,
133
- )
134
-
135
- # Create lag function for each holiday
137
+ # Use the holidayname as a default argument to capture it at definition time
136
138
  holiday_functions.update(
137
139
  {
138
140
  "is_"
139
- + holiday_name.replace(" ", "_").lower(): make_holiday_func(
140
- holidayname=holiday_name
141
+ + holiday_name.replace(
142
+ " ", "_"
143
+ ).lower(): lambda x, holiday_name_local=holiday_name: np.isin(
144
+ x.index.date,
145
+ df_holidays.datum[
146
+ df_holidays.name == holiday_name_local
147
+ ].values,
141
148
  )
142
149
  }
143
150
  )
@@ -178,9 +185,10 @@ def check_for_bridge_day(
178
185
  if date in country_holidays:
179
186
  return holiday_functions, bridge_days
180
187
 
181
- # Define function explicitely to mitigate 'late binding' problem
188
+ # Define function explicitly to mitigate 'late binding' problem
189
+ # Use a default argument to capture the date at definition time
182
190
  def make_holiday_func(requested_date):
183
- return lambda x: np.isin(x.index.date, np.array([requested_date]))
191
+ return lambda x, dt=requested_date: np.isin(x.index.date, np.array([dt]))
184
192
 
185
193
  # Looking forward: If day after tomorow is a national holiday or
186
194
  # a saturday check if tomorow is not a national holiday
@@ -304,9 +304,11 @@ class MedianRegressor(OpenstfRegressor, RegressorMixin):
304
304
 
305
305
  Which lag features are used is determined by the feature engineering step.
306
306
  """
307
- feature_names, frequency, feature_to_lags_in_min = (
308
- self._extract_and_validate_lags(x)
309
- )
307
+ (
308
+ feature_names,
309
+ frequency,
310
+ feature_to_lags_in_min,
311
+ ) = self._extract_and_validate_lags(x)
310
312
 
311
313
  self.feature_names_ = list(feature_names)
312
314
  self.frequency_ = frequency
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: openstef
3
- Version: 3.4.78
3
+ Version: 3.4.79
4
4
  Summary: Open short term energy forecaster
5
5
  Home-page: https://github.com/OpenSTEF/openstef
6
6
  Author: Alliander N.V
@@ -33,7 +33,7 @@ def read_long_description_from_readme():
33
33
 
34
34
  setup(
35
35
  name="openstef",
36
- version="3.4.78",
36
+ version="3.4.79",
37
37
  packages=find_packages(include=["openstef", "openstef.*"]),
38
38
  description="Open short term energy forecaster",
39
39
  long_description=read_long_description_from_readme(),
File without changes
File without changes
File without changes
File without changes
File without changes