Skip to content

Commit c835217

Browse files
TonyBagnallMatthewMiddlehurstalexbanwell1Alex Banwell
authored
[ENH] First PR for forecasting module (#2362)
* forecaster base and dummy * forecasting tests * forecasting tests * forecasting tests * forecasting tests * regression * notebook * regressor * regressor * regressor * tags * tags * requires_y * forecasting notebook * forecasting notebook * remove tags * fix forecasting testing (they still fail though) * _is_fitted -> is_fitted * _is_fitted -> is_fitted * _forecast * notebook * is_fitted * y_fitted * ETS forecaster * add y checks and conversion * add tag * tidy * _check_is_fitted() * _check_is_fitted() * Add fully functional ETS Forecaster. Modify base to not set default y in forecast. Update tests for ETS Forecaster. Add script to verify ETS Forecaster against statsforecast module using a large number of random parameter inputs. (#2318) Co-authored-by: Alex Banwell <[email protected]> * Ajb/forecasting (#2357) * Add fully functional ETS Forecaster. Modify base to not set default y in forecast. Update tests for ETS Forecaster. Add script to verify ETS Forecaster against statsforecast module using a large number of random parameter inputs. * Add faster numba version of ETS forecaster * Seperate out predict code, and add test to test without creating a class - significantly faster! * Modify _verify_ets.py to allow easy switching between statsforecast versions. This confirms that my algorithms without class overheads is significantly faster than nixtla statsforecast, and with class overheads, it is faster than their current algorithm * Add basic gradient decent optimization algorithm for smoothing parameters --------- Co-authored-by: Alex Banwell <[email protected]> * first forecasters * beta local * example * example * test regressor * forecasting notebook * base * base * ETS refactor * correct test * private forecast * remove duplicate * fit_is_empty check * fit_is_empty check * fix changed constant name * typo * n_timepoints * forecasting tests --------- Co-authored-by: MatthewMiddlehurst <[email protected]> Co-authored-by: alexbanwell1 <[email protected]> Co-authored-by: Alex Banwell <[email protected]>
1 parent 993d1d6 commit c835217

File tree

16 files changed

+1338
-42
lines changed

16 files changed

+1338
-42
lines changed

aeon/forecasting/__init__.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
"""Forecasters."""
2+
3+
__all__ = [
4+
"DummyForecaster",
5+
"BaseForecaster",
6+
"RegressionForecaster",
7+
"ETSForecaster",
8+
]
9+
10+
from aeon.forecasting._dummy import DummyForecaster
11+
from aeon.forecasting._ets import ETSForecaster
12+
from aeon.forecasting._regression import RegressionForecaster
13+
from aeon.forecasting.base import BaseForecaster

aeon/forecasting/_dummy.py

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
"""DummyForecaster always predicts the last value seen in training."""
2+
3+
from aeon.forecasting.base import BaseForecaster
4+
5+
6+
class DummyForecaster(BaseForecaster):
7+
"""Dummy forecaster always predicts the last value seen in training."""
8+
9+
def __init__(self):
10+
"""Initialize DummyForecaster."""
11+
self.last_value_ = None
12+
super().__init__(horizon=1, axis=1)
13+
14+
def _fit(self, y, exog=None):
15+
"""Fit dummy forecaster."""
16+
y = y.squeeze()
17+
self.last_value_ = y[-1]
18+
return self
19+
20+
def _predict(self, y=None, exog=None):
21+
"""Predict using dummy forecaster."""
22+
return self.last_value_
23+
24+
def _forecast(self, y, exog=None):
25+
"""Forecast using dummy forecaster."""
26+
y = y.squeeze()
27+
return y[-1]

0 commit comments

Comments
 (0)