openstef 3.4.26__tar.gz → 3.4.28__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.26 → openstef-3.4.28}/PKG-INFO +1 -1
- {openstef-3.4.26 → openstef-3.4.28}/openstef/data_classes/prediction_job.py +1 -0
- {openstef-3.4.26 → openstef-3.4.28}/openstef/enums.py +1 -0
- {openstef-3.4.26 → openstef-3.4.28}/openstef/model/confidence_interval_applicator.py +5 -2
- {openstef-3.4.26 → openstef-3.4.28}/openstef/model/model_creator.py +5 -0
- {openstef-3.4.26 → openstef-3.4.28}/openstef/model/regressors/dazls.py +4 -0
- openstef-3.4.28/openstef/model/regressors/flatliner.py +100 -0
- {openstef-3.4.26 → openstef-3.4.28}/openstef.egg-info/PKG-INFO +1 -1
- {openstef-3.4.26 → openstef-3.4.28}/openstef.egg-info/SOURCES.txt +1 -0
- {openstef-3.4.26 → openstef-3.4.28}/setup.py +1 -1
- {openstef-3.4.26 → openstef-3.4.28}/LICENSE +0 -0
- {openstef-3.4.26 → openstef-3.4.28}/README.md +0 -0
- {openstef-3.4.26 → openstef-3.4.28}/openstef/__init__.py +0 -0
- {openstef-3.4.26 → openstef-3.4.28}/openstef/__main__.py +0 -0
- {openstef-3.4.26 → openstef-3.4.28}/openstef/app_settings.py +0 -0
- {openstef-3.4.26 → openstef-3.4.28}/openstef/data/dutch_holidays_2020-2022.csv +0 -0
- {openstef-3.4.26 → openstef-3.4.28}/openstef/data/dutch_holidays_2020-2022.csv.license +0 -0
- {openstef-3.4.26 → openstef-3.4.28}/openstef/data/pv_single_coefs.csv +0 -0
- {openstef-3.4.26 → openstef-3.4.28}/openstef/data/pv_single_coefs.csv.license +0 -0
- {openstef-3.4.26 → openstef-3.4.28}/openstef/data_classes/__init__.py +0 -0
- {openstef-3.4.26 → openstef-3.4.28}/openstef/data_classes/data_prep.py +0 -0
- {openstef-3.4.26 → openstef-3.4.28}/openstef/data_classes/model_specifications.py +0 -0
- {openstef-3.4.26 → openstef-3.4.28}/openstef/data_classes/split_function.py +0 -0
- {openstef-3.4.26 → openstef-3.4.28}/openstef/exceptions.py +0 -0
- {openstef-3.4.26 → openstef-3.4.28}/openstef/feature_engineering/__init__.py +0 -0
- {openstef-3.4.26 → openstef-3.4.28}/openstef/feature_engineering/apply_features.py +0 -0
- {openstef-3.4.26 → openstef-3.4.28}/openstef/feature_engineering/data_preparation.py +0 -0
- {openstef-3.4.26 → openstef-3.4.28}/openstef/feature_engineering/feature_adder.py +0 -0
- {openstef-3.4.26 → openstef-3.4.28}/openstef/feature_engineering/feature_applicator.py +0 -0
- {openstef-3.4.26 → openstef-3.4.28}/openstef/feature_engineering/general.py +0 -0
- {openstef-3.4.26 → openstef-3.4.28}/openstef/feature_engineering/holiday_features.py +0 -0
- {openstef-3.4.26 → openstef-3.4.28}/openstef/feature_engineering/lag_features.py +0 -0
- {openstef-3.4.26 → openstef-3.4.28}/openstef/feature_engineering/missing_values_transformer.py +0 -0
- {openstef-3.4.26 → openstef-3.4.28}/openstef/feature_engineering/weather_features.py +0 -0
- {openstef-3.4.26 → openstef-3.4.28}/openstef/metrics/__init__.py +0 -0
- {openstef-3.4.26 → openstef-3.4.28}/openstef/metrics/figure.py +0 -0
- {openstef-3.4.26 → openstef-3.4.28}/openstef/metrics/metrics.py +0 -0
- {openstef-3.4.26 → openstef-3.4.28}/openstef/metrics/reporter.py +0 -0
- {openstef-3.4.26 → openstef-3.4.28}/openstef/model/__init__.py +0 -0
- {openstef-3.4.26 → openstef-3.4.28}/openstef/model/basecase.py +0 -0
- {openstef-3.4.26 → openstef-3.4.28}/openstef/model/fallback.py +0 -0
- {openstef-3.4.26 → openstef-3.4.28}/openstef/model/metamodels/__init__.py +0 -0
- {openstef-3.4.26 → openstef-3.4.28}/openstef/model/metamodels/grouped_regressor.py +0 -0
- {openstef-3.4.26 → openstef-3.4.28}/openstef/model/metamodels/missing_values_handler.py +0 -0
- {openstef-3.4.26 → openstef-3.4.28}/openstef/model/objective.py +0 -0
- {openstef-3.4.26 → openstef-3.4.28}/openstef/model/objective_creator.py +0 -0
- {openstef-3.4.26 → openstef-3.4.28}/openstef/model/regressors/__init__.py +0 -0
- {openstef-3.4.26 → openstef-3.4.28}/openstef/model/regressors/arima.py +0 -0
- {openstef-3.4.26 → openstef-3.4.28}/openstef/model/regressors/custom_regressor.py +0 -0
- {openstef-3.4.26 → openstef-3.4.28}/openstef/model/regressors/lgbm.py +0 -0
- {openstef-3.4.26 → openstef-3.4.28}/openstef/model/regressors/linear.py +0 -0
- {openstef-3.4.26 → openstef-3.4.28}/openstef/model/regressors/linear_quantile.py +0 -0
- {openstef-3.4.26 → openstef-3.4.28}/openstef/model/regressors/regressor.py +0 -0
- {openstef-3.4.26 → openstef-3.4.28}/openstef/model/regressors/xgb.py +0 -0
- {openstef-3.4.26 → openstef-3.4.28}/openstef/model/regressors/xgb_multioutput_quantile.py +0 -0
- {openstef-3.4.26 → openstef-3.4.28}/openstef/model/regressors/xgb_quantile.py +0 -0
- {openstef-3.4.26 → openstef-3.4.28}/openstef/model/serializer.py +0 -0
- {openstef-3.4.26 → openstef-3.4.28}/openstef/model/standard_deviation_generator.py +0 -0
- {openstef-3.4.26 → openstef-3.4.28}/openstef/model_selection/__init__.py +0 -0
- {openstef-3.4.26 → openstef-3.4.28}/openstef/model_selection/model_selection.py +0 -0
- {openstef-3.4.26 → openstef-3.4.28}/openstef/monitoring/__init__.py +0 -0
- {openstef-3.4.26 → openstef-3.4.28}/openstef/monitoring/performance_meter.py +0 -0
- {openstef-3.4.26 → openstef-3.4.28}/openstef/monitoring/teams.py +0 -0
- {openstef-3.4.26 → openstef-3.4.28}/openstef/pipeline/__init__.py +0 -0
- {openstef-3.4.26 → openstef-3.4.28}/openstef/pipeline/create_basecase_forecast.py +0 -0
- {openstef-3.4.26 → openstef-3.4.28}/openstef/pipeline/create_component_forecast.py +0 -0
- {openstef-3.4.26 → openstef-3.4.28}/openstef/pipeline/create_forecast.py +0 -0
- {openstef-3.4.26 → openstef-3.4.28}/openstef/pipeline/optimize_hyperparameters.py +0 -0
- {openstef-3.4.26 → openstef-3.4.28}/openstef/pipeline/train_create_forecast_backtest.py +0 -0
- {openstef-3.4.26 → openstef-3.4.28}/openstef/pipeline/train_model.py +0 -0
- {openstef-3.4.26 → openstef-3.4.28}/openstef/pipeline/utils.py +0 -0
- {openstef-3.4.26 → openstef-3.4.28}/openstef/postprocessing/__init__.py +0 -0
- {openstef-3.4.26 → openstef-3.4.28}/openstef/postprocessing/postprocessing.py +0 -0
- {openstef-3.4.26 → openstef-3.4.28}/openstef/preprocessing/__init__.py +0 -0
- {openstef-3.4.26 → openstef-3.4.28}/openstef/preprocessing/preprocessing.py +0 -0
- {openstef-3.4.26 → openstef-3.4.28}/openstef/settings.py +0 -0
- {openstef-3.4.26 → openstef-3.4.28}/openstef/tasks/__init__.py +0 -0
- {openstef-3.4.26 → openstef-3.4.28}/openstef/tasks/calculate_kpi.py +0 -0
- {openstef-3.4.26 → openstef-3.4.28}/openstef/tasks/create_basecase_forecast.py +0 -0
- {openstef-3.4.26 → openstef-3.4.28}/openstef/tasks/create_components_forecast.py +0 -0
- {openstef-3.4.26 → openstef-3.4.28}/openstef/tasks/create_forecast.py +0 -0
- {openstef-3.4.26 → openstef-3.4.28}/openstef/tasks/create_solar_forecast.py +0 -0
- {openstef-3.4.26 → openstef-3.4.28}/openstef/tasks/create_wind_forecast.py +0 -0
- {openstef-3.4.26 → openstef-3.4.28}/openstef/tasks/optimize_hyperparameters.py +0 -0
- {openstef-3.4.26 → openstef-3.4.28}/openstef/tasks/split_forecast.py +0 -0
- {openstef-3.4.26 → openstef-3.4.28}/openstef/tasks/train_model.py +0 -0
- {openstef-3.4.26 → openstef-3.4.28}/openstef/tasks/utils/__init__.py +0 -0
- {openstef-3.4.26 → openstef-3.4.28}/openstef/tasks/utils/dependencies.py +0 -0
- {openstef-3.4.26 → openstef-3.4.28}/openstef/tasks/utils/predictionjobloop.py +0 -0
- {openstef-3.4.26 → openstef-3.4.28}/openstef/tasks/utils/taskcontext.py +0 -0
- {openstef-3.4.26 → openstef-3.4.28}/openstef/validation/__init__.py +0 -0
- {openstef-3.4.26 → openstef-3.4.28}/openstef/validation/validation.py +0 -0
- {openstef-3.4.26 → openstef-3.4.28}/openstef.egg-info/dependency_links.txt +0 -0
- {openstef-3.4.26 → openstef-3.4.28}/openstef.egg-info/requires.txt +0 -0
- {openstef-3.4.26 → openstef-3.4.28}/openstef.egg-info/top_level.txt +0 -0
- {openstef-3.4.26 → openstef-3.4.28}/pyproject.toml +0 -0
- {openstef-3.4.26 → openstef-3.4.28}/setup.cfg +0 -0
@@ -73,8 +73,11 @@ class ConfidenceIntervalApplicator:
|
|
73
73
|
result = self._add_quantiles_to_forecast_quantile_regression(
|
74
74
|
temp_forecast, self.model.quantiles
|
75
75
|
)
|
76
|
-
self.logger.warning(
|
77
|
-
|
76
|
+
self.logger.warning(
|
77
|
+
"Quantiles are requested the model was not trained on. Using the quantiles the model was trained on",
|
78
|
+
requested_quantiles=pj["quantiles"],
|
79
|
+
trained_quantiles=self.model.quantiles,
|
80
|
+
)
|
78
81
|
return result
|
79
82
|
|
80
83
|
return self._add_quantiles_to_forecast_default(temp_forecast, pj["quantiles"])
|
@@ -13,6 +13,7 @@ from openstef.model.regressors.lgbm import LGBMOpenstfRegressor
|
|
13
13
|
from openstef.model.regressors.linear import LinearOpenstfRegressor
|
14
14
|
from openstef.model.regressors.linear_quantile import LinearQuantileOpenstfRegressor
|
15
15
|
from openstef.model.regressors.regressor import OpenstfRegressor
|
16
|
+
from openstef.model.regressors.flatliner import FlatlinerRegressor
|
16
17
|
from openstef.model.regressors.xgb import XGBOpenstfRegressor
|
17
18
|
from openstef.model.regressors.xgb_quantile import XGBQuantileOpenstfRegressor
|
18
19
|
from openstef.model.regressors.xgb_multioutput_quantile import (
|
@@ -105,6 +106,9 @@ valid_model_kwargs = {
|
|
105
106
|
"imputation_strategy",
|
106
107
|
"fill_value",
|
107
108
|
],
|
109
|
+
MLModelType.FLATLINER: [
|
110
|
+
"quantiles",
|
111
|
+
],
|
108
112
|
MLModelType.LINEAR_QUANTILE: [
|
109
113
|
"alpha",
|
110
114
|
"quantiles",
|
@@ -134,6 +138,7 @@ class ModelCreator:
|
|
134
138
|
MLModelType.LINEAR: LinearOpenstfRegressor,
|
135
139
|
MLModelType.LINEAR_QUANTILE: LinearQuantileOpenstfRegressor,
|
136
140
|
MLModelType.ARIMA: ARIMAOpenstfRegressor,
|
141
|
+
MLModelType.FLATLINER: FlatlinerRegressor,
|
137
142
|
}
|
138
143
|
|
139
144
|
@staticmethod
|
@@ -52,6 +52,7 @@ class Dazls(BaseEstimator):
|
|
52
52
|
Args:
|
53
53
|
features: inputs for domain and adaptation model (domain_model_input, adaptation_model_input)
|
54
54
|
target: the expected output (y_train)
|
55
|
+
|
55
56
|
"""
|
56
57
|
x, y = (
|
57
58
|
features.loc[:, self.baseline_input_columns],
|
@@ -76,6 +77,7 @@ class Dazls(BaseEstimator):
|
|
76
77
|
|
77
78
|
Returns:
|
78
79
|
prediction: The output prediction after both models.
|
80
|
+
|
79
81
|
"""
|
80
82
|
model_test_data = x.loc[:, self.baseline_input_columns]
|
81
83
|
|
@@ -90,6 +92,7 @@ class Dazls(BaseEstimator):
|
|
90
92
|
|
91
93
|
Returns:
|
92
94
|
RMSE and R2 scores
|
95
|
+
|
93
96
|
"""
|
94
97
|
rmse = (mean_squared_error(truth, prediction)) ** 0.5
|
95
98
|
r2_score_value = r2_score(truth, prediction)
|
@@ -100,6 +103,7 @@ class Dazls(BaseEstimator):
|
|
100
103
|
|
101
104
|
Returns:
|
102
105
|
Summary represented by a string
|
106
|
+
|
103
107
|
"""
|
104
108
|
summary_str = (
|
105
109
|
f"{self.__name__} model summary:\n\n"
|
@@ -0,0 +1,100 @@
|
|
1
|
+
# SPDX-FileCopyrightText: 2017-2023 Contributors to the OpenSTEF project <korte.termijn.prognoses@alliander.com> # noqa E501>
|
2
|
+
#
|
3
|
+
# SPDX-License-Identifier: MPL-2.0
|
4
|
+
import re
|
5
|
+
from typing import Dict, Union, Set, Optional, List
|
6
|
+
|
7
|
+
import numpy as np
|
8
|
+
import pandas as pd
|
9
|
+
from sklearn.base import RegressorMixin
|
10
|
+
from sklearn.linear_model import QuantileRegressor
|
11
|
+
from sklearn.preprocessing import MinMaxScaler
|
12
|
+
from sklearn.utils.validation import check_is_fitted
|
13
|
+
|
14
|
+
from openstef.feature_engineering.missing_values_transformer import (
|
15
|
+
MissingValuesTransformer,
|
16
|
+
)
|
17
|
+
from openstef.model.regressors.regressor import OpenstfRegressor
|
18
|
+
|
19
|
+
|
20
|
+
class FlatlinerRegressor(OpenstfRegressor, RegressorMixin):
|
21
|
+
feature_names_: List[str] = []
|
22
|
+
|
23
|
+
def __init__(self, quantiles=None):
|
24
|
+
"""Initialize FlatlinerRegressor.
|
25
|
+
|
26
|
+
The model always predicts 0.0, regardless of the input features. The model is
|
27
|
+
meant to be used for flatliner locations that still expect a prediction while
|
28
|
+
preserving the prediction interface.
|
29
|
+
"""
|
30
|
+
super().__init__()
|
31
|
+
self.quantiles = quantiles
|
32
|
+
|
33
|
+
@property
|
34
|
+
def feature_names(self) -> list:
|
35
|
+
"""The names of the features used to train the model."""
|
36
|
+
check_is_fitted(self)
|
37
|
+
return self.feature_names_
|
38
|
+
|
39
|
+
@staticmethod
|
40
|
+
def _get_importance_names():
|
41
|
+
return {
|
42
|
+
"gain_importance_name": "total_gain",
|
43
|
+
"weight_importance_name": "weight",
|
44
|
+
}
|
45
|
+
|
46
|
+
@property
|
47
|
+
def can_predict_quantiles(self) -> bool:
|
48
|
+
"""Attribute that indicates if the model predict particular quantiles."""
|
49
|
+
return True
|
50
|
+
|
51
|
+
def fit(self, x: pd.DataFrame, y: pd.Series, **kwargs) -> RegressorMixin:
|
52
|
+
"""Fits flatliner model.
|
53
|
+
|
54
|
+
Args:
|
55
|
+
x: Feature matrix
|
56
|
+
y: Labels
|
57
|
+
|
58
|
+
Returns:
|
59
|
+
Fitted LinearQuantile model
|
60
|
+
|
61
|
+
"""
|
62
|
+
self.feature_names_ = list(x.columns)
|
63
|
+
self.feature_importances_ = np.ones(len(self.feature_names_)) / (
|
64
|
+
len(self.feature_names_) or 1.0
|
65
|
+
)
|
66
|
+
|
67
|
+
return self
|
68
|
+
|
69
|
+
def predict(self, x: pd.DataFrame, quantile: float = 0.5, **kwargs) -> np.array:
|
70
|
+
"""Makes a prediction for a desired quantile.
|
71
|
+
|
72
|
+
Args:
|
73
|
+
x: Feature matrix
|
74
|
+
quantile: Quantile for which a prediciton is desired,
|
75
|
+
note that only quantile are available for which a model is trained,
|
76
|
+
and that this is a quantile-model specific keyword
|
77
|
+
|
78
|
+
Returns:
|
79
|
+
Prediction
|
80
|
+
|
81
|
+
Raises:
|
82
|
+
ValueError in case no model is trained for the requested quantile
|
83
|
+
|
84
|
+
"""
|
85
|
+
check_is_fitted(self)
|
86
|
+
|
87
|
+
return np.zeros(x.shape[0])
|
88
|
+
|
89
|
+
def _get_feature_importance_from_linear(self, quantile: float = 0.5) -> np.array:
|
90
|
+
check_is_fitted(self)
|
91
|
+
return np.array([0.0 for _ in self.feature_names_])
|
92
|
+
|
93
|
+
@classmethod
|
94
|
+
def _get_param_names(cls):
|
95
|
+
return [
|
96
|
+
"quantiles",
|
97
|
+
]
|
98
|
+
|
99
|
+
def __sklearn_is_fitted__(self) -> bool:
|
100
|
+
return True
|
@@ -53,6 +53,7 @@ openstef/model/regressors/__init__.py
|
|
53
53
|
openstef/model/regressors/arima.py
|
54
54
|
openstef/model/regressors/custom_regressor.py
|
55
55
|
openstef/model/regressors/dazls.py
|
56
|
+
openstef/model/regressors/flatliner.py
|
56
57
|
openstef/model/regressors/lgbm.py
|
57
58
|
openstef/model/regressors/linear.py
|
58
59
|
openstef/model/regressors/linear_quantile.py
|
@@ -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.28",
|
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
|
{openstef-3.4.26 → openstef-3.4.28}/openstef/feature_engineering/missing_values_transformer.py
RENAMED
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
|