mirror of
https://github.com/Akkudoktor-EOS/EOS.git
synced 2025-04-19 08:55:15 +00:00
base functions
This commit is contained in:
parent
6bcae41213
commit
e0bdbdcb81
@ -13,3 +13,4 @@ pendulum==3.0.0
|
||||
platformdirs==4.3.6
|
||||
pvlib==0.11.1
|
||||
pydantic==2.10.4
|
||||
statsmodels==0.14.4
|
@ -122,7 +122,7 @@ class ElecPriceAkkudoktor(ElecPriceProvider):
|
||||
self.update_datetime = to_datetime(in_timezone=self.config.timezone)
|
||||
return akkudoktor_data
|
||||
|
||||
def cap_outliers(data, sigma=2): # remove outliers
|
||||
def cap_outliers(data: np.ndarray, sigma: int = 2) -> np.ndarray:
|
||||
mean = data.mean()
|
||||
std = data.std()
|
||||
lower_bound = mean - sigma * std
|
||||
@ -131,13 +131,13 @@ class ElecPriceAkkudoktor(ElecPriceProvider):
|
||||
return capped_data
|
||||
|
||||
def predict_ets(
|
||||
history,
|
||||
seasonal_periods,
|
||||
):
|
||||
history: np.ndarray, seasonal_periods: int, prediction_hours: int
|
||||
) -> np.ndarray:
|
||||
clean_history = cap_outliers(history)
|
||||
model = ExponentialSmoothing(
|
||||
history, seasonal="add", seasonal_periods=seasonal_periods
|
||||
clean_history, seasonal="add", seasonal_periods=seasonal_periods
|
||||
).fit()
|
||||
return model.forecast(7 * 24)
|
||||
return model.forecast(prediction_hours)
|
||||
|
||||
def _update_data(self, force_update: Optional[bool] = False) -> None:
|
||||
"""Update forecast data in the ElecPriceDataRecord format.
|
||||
|
Loading…
x
Reference in New Issue
Block a user