Skip to content

Commit bbdc018

Browse files
committed
base forecaster
1 parent da592e7 commit bbdc018

File tree

4 files changed

+17
-37
lines changed

4 files changed

+17
-37
lines changed

tsml_eval/_wip/forecasting/base.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,9 @@ def __init__(self, horizon=1, window=None):
4545
self.horizon = horizon
4646
self.window = window
4747
self._is_fitted = False
48-
super().__init__()
48+
super().__init__(axis=1)
4949

50-
@abstract
50+
@abstractmethod
5151
def fit(self, X):
5252
"""Fit forecaster to series X.
5353
@@ -58,7 +58,7 @@ def fit(self, X):
5858
"""
5959
...
6060

61-
@abstract
61+
@abstractmethod
6262
def predict(self, X):
6363
"""
6464

tsml_eval/_wip/forecasting/ets.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
from tsml_eval._wip.forecasting.base import BaseForecaster
2+
3+
4+
def ETSForecaster(BaseForecaster):
5+
6+
7+
def __init__(self, horizon=1, window=None):
8+
self.horizon = horizon
9+
self.window = window
10+
self._is_fitted = False
11+
super().__init__()
12+

tsml_eval/_wip/forecasting/exponential_smoothing.py

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -69,39 +69,6 @@ def fit_ets(y, n, x, m, error, trend, season, alpha, beta, gamma, phi, e, lik, a
6969
nmse : int
7070
The number of steps ahead to be considered for the calculation of AMSE. Determines
7171
the forcasting horizon.
72-
y : np.ndarray
73-
Time series data.
74-
n : int
75-
The length of the time series.
76-
x : np.ndarray
77-
Initial states of the ETS model. Starting values for the level, trend, and seasonal
78-
components. This variable evolves during execution to store the states at each time
79-
step (i.e., the state space matrix).
80-
m : int
81-
The period of the seasonality (e.g., for quaterly data m = 4)
82-
error : int
83-
The type of error model (0 -> None, 1 -> additive, 2 -> multiplicative).
84-
trend : int
85-
The type of trend model (0 -> None, 1 -> additive, 2 -> multiplicative).
86-
season : int
87-
The type of seasonality model (0 -> None, 1 -> additive, 2 -> multiplicative).
88-
alpha : float
89-
Smoothing parameter for the level.
90-
beta : float
91-
Smoothing parameter for the trend.
92-
gamma : float
93-
Smoothing parameter for the seasonality.
94-
phi : float
95-
Damping parameter.
96-
e : np.ndarray
97-
Residuals of the fitted model.
98-
lik : np.ndarray
99-
Likelihood measure.
100-
amse : np.ndarray
101-
Empty array for storing the Average Mean Squared Error.
102-
nmse : int
103-
The number of steps ahead to be considered for the calculation of AMSE. Determines
104-
the forcasting horizon.
10572
10673
Returns
10774
-------

tsml_eval/_wip/forecasting/window_base.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
import numpy as np
22
from tsml_eval._wip.forecasting.base import BaseForecaster
3+
from abc import ABC, abstractmethod
4+
from typing import final
35
from sklearn.linear_model import LinearRegression
4-
56
class BaseWindowForecaster(BaseForecaster):
67
def __init__(self, window, horizon=1, regressor=LinearRegression()):
78
self.regressor = regressor

0 commit comments

Comments
 (0)