[ENH] Make fit in ARIMA iterative_forecast optional
Describe the feature or idea you want to propose
Hi,
First, thank you for the great work on implementing a Python-native and efficient version of ARIMA.
The current implementation of aeon.forecasting.stats.ARIMA.iterative_forecast includes fitting the forecaster as its first step:
https://github.com/aeon-toolkit/aeon/blob/c80baf772dcf0e60aaaae87c27d1befdef90a7b4/aeon/forecasting/stats/_arima.py#L210
If the ARIMA model has already been fitted, this additional fit step is unnecessary. All the required information for subsequent predictions is already stored in the fitted model.
An option to skip this initial fit will speed up the iterative forecast when the model is already fitted.
Describe your proposed solution
A possible solution would be to include an optional argument (e.g., fit=True) in iterative_forecast.
- If
fit=True, the method behaves as it currently does. - If
fit=False, the method skips the redundant fitting step and uses the already-fitted model directly.
def iterative_forecast(self, y, prediction_horizon, fit=True):
if fit:
self.fit(y)
Describe alternatives you've considered, if relevant
No response
Additional context
No response
thanks @JoaquinAmatRodrigo we will discuss it. On the one hand I want to minimise parameters, on the other, it seems sensible!
Hi! @TonyBagnall @JoaquinAmatRodrigo @MatthewMiddlehurst I'd like to work on this issue.
My plan is:
- Add an optional
fitparameter toiterative_forecast(defaulting toTrueto preserve current behaviour). - When
fit=False, skip the internalself.fit(y)call and use the already-fitted model for forecasting. - Add tests to ensure:
- Behaviour remains unchanged when
fit=True - Forecasting works correctly without refitting when
fit=False - The method raises a meaningful error if
fit=Falseis used before the model has been fitted.
- Behaviour remains unchanged when
Please let me know if this approach aligns with what you have in mind!