openstef 3.4.39__tar.gz → 3.4.42__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.39 → openstef-3.4.42}/PKG-INFO +2 -2
- {openstef-3.4.39 → openstef-3.4.42}/README.md +1 -1
- {openstef-3.4.39 → openstef-3.4.42}/openstef/feature_engineering/missing_values_transformer.py +1 -0
- {openstef-3.4.39 → openstef-3.4.42}/openstef/model/model_creator.py +3 -0
- {openstef-3.4.39 → openstef-3.4.42}/openstef/model/regressors/linear_quantile.py +50 -6
- {openstef-3.4.39 → openstef-3.4.42}/openstef/validation/validation.py +1 -1
- {openstef-3.4.39 → openstef-3.4.42}/openstef.egg-info/PKG-INFO +2 -2
- {openstef-3.4.39 → openstef-3.4.42}/setup.py +1 -1
- {openstef-3.4.39 → openstef-3.4.42}/LICENSE +0 -0
- {openstef-3.4.39 → openstef-3.4.42}/openstef/__init__.py +0 -0
- {openstef-3.4.39 → openstef-3.4.42}/openstef/__main__.py +0 -0
- {openstef-3.4.39 → openstef-3.4.42}/openstef/app_settings.py +0 -0
- {openstef-3.4.39 → openstef-3.4.42}/openstef/data/dazls_model_3.4.24/dazls_stored_3.4.24_baseline_model.z +0 -0
- {openstef-3.4.39 → openstef-3.4.42}/openstef/data/dazls_model_3.4.24/dazls_stored_3.4.24_baseline_model.z.license +0 -0
- {openstef-3.4.39 → openstef-3.4.42}/openstef/data/dazls_model_3.4.24/dazls_stored_3.4.24_model_card.md +0 -0
- {openstef-3.4.39 → openstef-3.4.42}/openstef/data/dazls_model_3.4.24/dazls_stored_3.4.24_model_card.md.license +0 -0
- {openstef-3.4.39 → openstef-3.4.42}/openstef/data/dutch_holidays.csv +0 -0
- {openstef-3.4.39 → openstef-3.4.42}/openstef/data/dutch_holidays.csv.license +0 -0
- {openstef-3.4.39 → openstef-3.4.42}/openstef/data/pv_single_coefs.csv +0 -0
- {openstef-3.4.39 → openstef-3.4.42}/openstef/data/pv_single_coefs.csv.license +0 -0
- {openstef-3.4.39 → openstef-3.4.42}/openstef/data_classes/__init__.py +0 -0
- {openstef-3.4.39 → openstef-3.4.42}/openstef/data_classes/data_prep.py +0 -0
- {openstef-3.4.39 → openstef-3.4.42}/openstef/data_classes/model_specifications.py +0 -0
- {openstef-3.4.39 → openstef-3.4.42}/openstef/data_classes/prediction_job.py +0 -0
- {openstef-3.4.39 → openstef-3.4.42}/openstef/data_classes/split_function.py +0 -0
- {openstef-3.4.39 → openstef-3.4.42}/openstef/enums.py +0 -0
- {openstef-3.4.39 → openstef-3.4.42}/openstef/exceptions.py +0 -0
- {openstef-3.4.39 → openstef-3.4.42}/openstef/feature_engineering/__init__.py +0 -0
- {openstef-3.4.39 → openstef-3.4.42}/openstef/feature_engineering/apply_features.py +0 -0
- {openstef-3.4.39 → openstef-3.4.42}/openstef/feature_engineering/data_preparation.py +0 -0
- {openstef-3.4.39 → openstef-3.4.42}/openstef/feature_engineering/feature_adder.py +0 -0
- {openstef-3.4.39 → openstef-3.4.42}/openstef/feature_engineering/feature_applicator.py +0 -0
- {openstef-3.4.39 → openstef-3.4.42}/openstef/feature_engineering/general.py +0 -0
- {openstef-3.4.39 → openstef-3.4.42}/openstef/feature_engineering/holiday_features.py +0 -0
- {openstef-3.4.39 → openstef-3.4.42}/openstef/feature_engineering/lag_features.py +0 -0
- {openstef-3.4.39 → openstef-3.4.42}/openstef/feature_engineering/weather_features.py +0 -0
- {openstef-3.4.39 → openstef-3.4.42}/openstef/metrics/__init__.py +0 -0
- {openstef-3.4.39 → openstef-3.4.42}/openstef/metrics/figure.py +0 -0
- {openstef-3.4.39 → openstef-3.4.42}/openstef/metrics/metrics.py +0 -0
- {openstef-3.4.39 → openstef-3.4.42}/openstef/metrics/reporter.py +0 -0
- {openstef-3.4.39 → openstef-3.4.42}/openstef/model/__init__.py +0 -0
- {openstef-3.4.39 → openstef-3.4.42}/openstef/model/basecase.py +0 -0
- {openstef-3.4.39 → openstef-3.4.42}/openstef/model/confidence_interval_applicator.py +0 -0
- {openstef-3.4.39 → openstef-3.4.42}/openstef/model/fallback.py +0 -0
- {openstef-3.4.39 → openstef-3.4.42}/openstef/model/metamodels/__init__.py +0 -0
- {openstef-3.4.39 → openstef-3.4.42}/openstef/model/metamodels/grouped_regressor.py +0 -0
- {openstef-3.4.39 → openstef-3.4.42}/openstef/model/metamodels/missing_values_handler.py +0 -0
- {openstef-3.4.39 → openstef-3.4.42}/openstef/model/objective.py +0 -0
- {openstef-3.4.39 → openstef-3.4.42}/openstef/model/objective_creator.py +0 -0
- {openstef-3.4.39 → openstef-3.4.42}/openstef/model/regressors/__init__.py +0 -0
- {openstef-3.4.39 → openstef-3.4.42}/openstef/model/regressors/arima.py +0 -0
- {openstef-3.4.39 → openstef-3.4.42}/openstef/model/regressors/custom_regressor.py +0 -0
- {openstef-3.4.39 → openstef-3.4.42}/openstef/model/regressors/dazls.py +0 -0
- {openstef-3.4.39 → openstef-3.4.42}/openstef/model/regressors/flatliner.py +0 -0
- {openstef-3.4.39 → openstef-3.4.42}/openstef/model/regressors/lgbm.py +0 -0
- {openstef-3.4.39 → openstef-3.4.42}/openstef/model/regressors/linear.py +0 -0
- {openstef-3.4.39 → openstef-3.4.42}/openstef/model/regressors/regressor.py +0 -0
- {openstef-3.4.39 → openstef-3.4.42}/openstef/model/regressors/xgb.py +0 -0
- {openstef-3.4.39 → openstef-3.4.42}/openstef/model/regressors/xgb_multioutput_quantile.py +0 -0
- {openstef-3.4.39 → openstef-3.4.42}/openstef/model/regressors/xgb_quantile.py +0 -0
- {openstef-3.4.39 → openstef-3.4.42}/openstef/model/serializer.py +0 -0
- {openstef-3.4.39 → openstef-3.4.42}/openstef/model/standard_deviation_generator.py +0 -0
- {openstef-3.4.39 → openstef-3.4.42}/openstef/model_selection/__init__.py +0 -0
- {openstef-3.4.39 → openstef-3.4.42}/openstef/model_selection/model_selection.py +0 -0
- {openstef-3.4.39 → openstef-3.4.42}/openstef/monitoring/__init__.py +0 -0
- {openstef-3.4.39 → openstef-3.4.42}/openstef/monitoring/performance_meter.py +0 -0
- {openstef-3.4.39 → openstef-3.4.42}/openstef/monitoring/teams.py +0 -0
- {openstef-3.4.39 → openstef-3.4.42}/openstef/pipeline/__init__.py +0 -0
- {openstef-3.4.39 → openstef-3.4.42}/openstef/pipeline/create_basecase_forecast.py +0 -0
- {openstef-3.4.39 → openstef-3.4.42}/openstef/pipeline/create_component_forecast.py +0 -0
- {openstef-3.4.39 → openstef-3.4.42}/openstef/pipeline/create_forecast.py +0 -0
- {openstef-3.4.39 → openstef-3.4.42}/openstef/pipeline/optimize_hyperparameters.py +0 -0
- {openstef-3.4.39 → openstef-3.4.42}/openstef/pipeline/train_create_forecast_backtest.py +0 -0
- {openstef-3.4.39 → openstef-3.4.42}/openstef/pipeline/train_model.py +0 -0
- {openstef-3.4.39 → openstef-3.4.42}/openstef/pipeline/utils.py +0 -0
- {openstef-3.4.39 → openstef-3.4.42}/openstef/postprocessing/__init__.py +0 -0
- {openstef-3.4.39 → openstef-3.4.42}/openstef/postprocessing/postprocessing.py +0 -0
- {openstef-3.4.39 → openstef-3.4.42}/openstef/preprocessing/__init__.py +0 -0
- {openstef-3.4.39 → openstef-3.4.42}/openstef/preprocessing/preprocessing.py +0 -0
- {openstef-3.4.39 → openstef-3.4.42}/openstef/settings.py +0 -0
- {openstef-3.4.39 → openstef-3.4.42}/openstef/tasks/__init__.py +0 -0
- {openstef-3.4.39 → openstef-3.4.42}/openstef/tasks/calculate_kpi.py +0 -0
- {openstef-3.4.39 → openstef-3.4.42}/openstef/tasks/create_basecase_forecast.py +0 -0
- {openstef-3.4.39 → openstef-3.4.42}/openstef/tasks/create_components_forecast.py +0 -0
- {openstef-3.4.39 → openstef-3.4.42}/openstef/tasks/create_forecast.py +0 -0
- {openstef-3.4.39 → openstef-3.4.42}/openstef/tasks/create_solar_forecast.py +0 -0
- {openstef-3.4.39 → openstef-3.4.42}/openstef/tasks/create_wind_forecast.py +0 -0
- {openstef-3.4.39 → openstef-3.4.42}/openstef/tasks/optimize_hyperparameters.py +0 -0
- {openstef-3.4.39 → openstef-3.4.42}/openstef/tasks/split_forecast.py +0 -0
- {openstef-3.4.39 → openstef-3.4.42}/openstef/tasks/train_model.py +0 -0
- {openstef-3.4.39 → openstef-3.4.42}/openstef/tasks/utils/__init__.py +0 -0
- {openstef-3.4.39 → openstef-3.4.42}/openstef/tasks/utils/dependencies.py +0 -0
- {openstef-3.4.39 → openstef-3.4.42}/openstef/tasks/utils/predictionjobloop.py +0 -0
- {openstef-3.4.39 → openstef-3.4.42}/openstef/tasks/utils/taskcontext.py +0 -0
- {openstef-3.4.39 → openstef-3.4.42}/openstef/validation/__init__.py +0 -0
- {openstef-3.4.39 → openstef-3.4.42}/openstef.egg-info/SOURCES.txt +0 -0
- {openstef-3.4.39 → openstef-3.4.42}/openstef.egg-info/dependency_links.txt +0 -0
- {openstef-3.4.39 → openstef-3.4.42}/openstef.egg-info/requires.txt +0 -0
- {openstef-3.4.39 → openstef-3.4.42}/openstef.egg-info/top_level.txt +0 -0
- {openstef-3.4.39 → openstef-3.4.42}/pyproject.toml +0 -0
- {openstef-3.4.39 → openstef-3.4.42}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: openstef
|
3
|
-
Version: 3.4.
|
3
|
+
Version: 3.4.42
|
4
4
|
Summary: Open short term energy forecaster
|
5
5
|
Home-page: https://github.com/OpenSTEF/openstef
|
6
6
|
Author: Alliander N.V
|
@@ -87,7 +87,7 @@ OpenSTEF is a Python package designed for generating short-term forecasts in the
|
|
87
87
|
pip install openstef
|
88
88
|
```
|
89
89
|
|
90
|
-
### Remark regarding installation within a **conda environment on Windows
|
90
|
+
### Remark regarding installation within a **conda environment on Windows**
|
91
91
|
|
92
92
|
A version of the pywin32 package will be installed as a secondary dependency along with the installation of the openstef package. Since conda relies on an old version of pywin32, the new installation can break conda's functionality. The following command can solve this issue:
|
93
93
|
```shell
|
@@ -50,7 +50,7 @@ OpenSTEF is a Python package designed for generating short-term forecasts in the
|
|
50
50
|
pip install openstef
|
51
51
|
```
|
52
52
|
|
53
|
-
### Remark regarding installation within a **conda environment on Windows
|
53
|
+
### Remark regarding installation within a **conda environment on Windows**
|
54
54
|
|
55
55
|
A version of the pywin32 package will be installed as a secondary dependency along with the installation of the openstef package. Since conda relies on an old version of pywin32, the new installation can break conda's functionality. The following command can solve this issue:
|
56
56
|
```shell
|
{openstef-3.4.39 → openstef-3.4.42}/openstef/feature_engineering/missing_values_transformer.py
RENAMED
@@ -41,6 +41,7 @@ class MissingValuesTransformer:
|
|
41
41
|
no_fill_future_values_features: The features for which it does not make sense
|
42
42
|
to fill future values. Rows that contain trailing null values for these
|
43
43
|
features will be removed from the data.
|
44
|
+
|
44
45
|
"""
|
45
46
|
self.missing_values = missing_values
|
46
47
|
self.imputation_strategy = imputation_strategy
|
@@ -8,7 +8,7 @@ import numpy as np
|
|
8
8
|
import pandas as pd
|
9
9
|
from sklearn.base import RegressorMixin
|
10
10
|
from sklearn.linear_model import QuantileRegressor
|
11
|
-
from sklearn.preprocessing import
|
11
|
+
from sklearn.preprocessing import StandardScaler
|
12
12
|
from sklearn.utils.validation import check_is_fitted
|
13
13
|
|
14
14
|
from openstef.feature_engineering.missing_values_transformer import (
|
@@ -25,8 +25,8 @@ class LinearQuantileOpenstfRegressor(OpenstfRegressor, RegressorMixin):
|
|
25
25
|
solver: str
|
26
26
|
|
27
27
|
imputer_: MissingValuesTransformer
|
28
|
-
x_scaler_:
|
29
|
-
y_scaler_:
|
28
|
+
x_scaler_: StandardScaler
|
29
|
+
y_scaler_: StandardScaler
|
30
30
|
models_: Dict[float, QuantileRegressor]
|
31
31
|
|
32
32
|
is_fitted_: bool = False
|
@@ -47,6 +47,9 @@ class LinearQuantileOpenstfRegressor(OpenstfRegressor, RegressorMixin):
|
|
47
47
|
missing_values: Union[int, float, str, None] = np.nan,
|
48
48
|
imputation_strategy: Optional[str] = "mean",
|
49
49
|
fill_value: Union[str, int, float] = None,
|
50
|
+
weight_scale_percentile: int = 95,
|
51
|
+
weight_exponent: float = 1,
|
52
|
+
weight_floor: float = 0.1,
|
50
53
|
no_fill_future_values_features: List[str] = None,
|
51
54
|
):
|
52
55
|
"""Initialize LinearQuantileOpenstfRegressor.
|
@@ -70,6 +73,9 @@ class LinearQuantileOpenstfRegressor(OpenstfRegressor, RegressorMixin):
|
|
70
73
|
missing_values: Value to be considered as missing value
|
71
74
|
imputation_strategy: Imputation strategy
|
72
75
|
fill_value: Fill value
|
76
|
+
weight_scale_percentile: Percentile used in scaling of the samples
|
77
|
+
weight_exponent: Exponent used in sample weighing
|
78
|
+
weight_floor: Minimum weight for samples
|
73
79
|
no_fill_future_values_features: The features for which it does not make sense
|
74
80
|
to fill future values. Rows that contain trailing null values for these
|
75
81
|
features will be removed from the data.
|
@@ -86,14 +92,17 @@ class LinearQuantileOpenstfRegressor(OpenstfRegressor, RegressorMixin):
|
|
86
92
|
self.quantiles = quantiles
|
87
93
|
self.alpha = alpha
|
88
94
|
self.solver = solver
|
95
|
+
self.weight_scale_percentile = weight_scale_percentile
|
96
|
+
self.weight_exponent = weight_exponent
|
97
|
+
self.weight_floor = weight_floor
|
89
98
|
self.imputer_ = MissingValuesTransformer(
|
90
99
|
missing_values=missing_values,
|
91
100
|
imputation_strategy=imputation_strategy,
|
92
101
|
fill_value=fill_value,
|
93
102
|
no_fill_future_values_features=no_fill_future_values_features,
|
94
103
|
)
|
95
|
-
self.x_scaler_ =
|
96
|
-
self.y_scaler_ =
|
104
|
+
self.x_scaler_ = StandardScaler()
|
105
|
+
self.y_scaler_ = StandardScaler()
|
97
106
|
self.models_ = {
|
98
107
|
quantile: QuantileRegressor(alpha=alpha, quantile=quantile, solver=solver)
|
99
108
|
for quantile in quantiles
|
@@ -182,7 +191,7 @@ class LinearQuantileOpenstfRegressor(OpenstfRegressor, RegressorMixin):
|
|
182
191
|
y_scaled = self.y_scaler_.fit_transform(y.to_frame())[:, 0]
|
183
192
|
|
184
193
|
# Add more focus on extreme / peak values
|
185
|
-
sample_weight =
|
194
|
+
sample_weight = self._calculate_sample_weights(y.values.squeeze())
|
186
195
|
|
187
196
|
# Fit quantile regressors
|
188
197
|
for quantile in self.quantiles:
|
@@ -196,6 +205,33 @@ class LinearQuantileOpenstfRegressor(OpenstfRegressor, RegressorMixin):
|
|
196
205
|
|
197
206
|
return self
|
198
207
|
|
208
|
+
def _calculate_sample_weights(self, y: np.array):
|
209
|
+
"""Calculate sample weights based on the y values of arbitrary scale.
|
210
|
+
|
211
|
+
The resulting weights are in the range [0,1] and are used to put more emphasis
|
212
|
+
on certain samples. The sample weighting function does:
|
213
|
+
|
214
|
+
* Rescale data to a [-1, 1] range using quantile scaling. 90% of the data will
|
215
|
+
be within this range. Rest is outside.
|
216
|
+
* Calculate the weight by taking the exponent of scaled data.
|
217
|
+
* exponent=0: Results in uniform weights for all samples.
|
218
|
+
* exponent=1: Results in linearly increasing weights for samples that are
|
219
|
+
closer to the extremes.
|
220
|
+
* exponent>1: Results in exponentially increasing weights for samples that are
|
221
|
+
closer to the extremes.
|
222
|
+
* Clip the data to [0, 1] range with weight_floor as the minimum weight.
|
223
|
+
* Weight floor is used to make sure that all the samples are considered.
|
224
|
+
|
225
|
+
"""
|
226
|
+
return np.clip(
|
227
|
+
_weight_exp(
|
228
|
+
_scale_percentile(y, percentile=self.weight_scale_percentile),
|
229
|
+
exponent=self.weight_exponent,
|
230
|
+
),
|
231
|
+
a_min=self.weight_floor,
|
232
|
+
a_max=1,
|
233
|
+
)
|
234
|
+
|
199
235
|
def predict(self, x: pd.DataFrame, quantile: float = 0.5, **kwargs) -> np.array:
|
200
236
|
"""Makes a prediction for a desired quantile.
|
201
237
|
|
@@ -250,3 +286,11 @@ class LinearQuantileOpenstfRegressor(OpenstfRegressor, RegressorMixin):
|
|
250
286
|
|
251
287
|
def __sklearn_is_fitted__(self) -> bool:
|
252
288
|
return self.is_fitted_
|
289
|
+
|
290
|
+
|
291
|
+
def _scale_percentile(x: np.ndarray, percentile: int = 95):
|
292
|
+
return np.abs(x / np.percentile(np.abs(x), percentile))
|
293
|
+
|
294
|
+
|
295
|
+
def _weight_exp(x: np.ndarray, exponent: float = 1):
|
296
|
+
return np.abs(x) ** exponent
|
@@ -244,7 +244,7 @@ def detect_ongoing_zero_flatliner(
|
|
244
244
|
"""
|
245
245
|
# remove all timestamps in the future
|
246
246
|
load = load[load.index.tz_localize(None) <= datetime.utcnow()]
|
247
|
-
latest_measurement_time = load.index.max()
|
247
|
+
latest_measurement_time = load.dropna().index.max()
|
248
248
|
latest_measurements = load[
|
249
249
|
latest_measurement_time - timedelta(minutes=duration_threshold_minutes) :
|
250
250
|
].dropna()
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: openstef
|
3
|
-
Version: 3.4.
|
3
|
+
Version: 3.4.42
|
4
4
|
Summary: Open short term energy forecaster
|
5
5
|
Home-page: https://github.com/OpenSTEF/openstef
|
6
6
|
Author: Alliander N.V
|
@@ -87,7 +87,7 @@ OpenSTEF is a Python package designed for generating short-term forecasts in the
|
|
87
87
|
pip install openstef
|
88
88
|
```
|
89
89
|
|
90
|
-
### Remark regarding installation within a **conda environment on Windows
|
90
|
+
### Remark regarding installation within a **conda environment on Windows**
|
91
91
|
|
92
92
|
A version of the pywin32 package will be installed as a secondary dependency along with the installation of the openstef package. Since conda relies on an old version of pywin32, the new installation can break conda's functionality. The following command can solve this issue:
|
93
93
|
```shell
|
@@ -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.42",
|
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
|
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
|
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
|