You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
historical_forecasts always retrains the model ignoring the retrain argument.
To Reproduce
This was likely introduced in #1465. Adding model = self.untrained_model() no longer sets self._fit_called. When evaluating whether to retrain not self._fit_called is always true.
importpandasaspdimportnumpyasnpimportmatplotlib.pyplotaspltfromdartsimportTimeSeriesfromdartsimportmodelsfromdarts.datasetsimportAirPassengersDatasetseries_air=AirPassengersDataset().load().astype(np.float32)
model=models.LinearRegressionModel(lags=4)
model.historical_forecasts(
series_air,
start=0.9,
retrain=False, # <-- this is ignored
)
Expected behavior
forecasting models to respect the retrain parameter.
System (please complete the following information):
Python version: 3.9.16
darts version 0.23.1
The text was updated successfully, but these errors were encountered:
We introduced this in #1465 to avoid mutating the underlying model object.
The model in this case gets retrained because it was not fit before (Darts requires the models to be fit before prediction).
You are right that it is an unexpected behavior that if retrain=False, the model still gets retrained.
We should raise an error when retrain=False and the model was not fit before.
You can avoid the retraining by fitting the model once before calling historical_forecasts()
Describe the bug
historical_forecasts always retrains the model ignoring the retrain argument.
To Reproduce
This was likely introduced in #1465. Adding
model = self.untrained_model()
no longer setsself._fit_called
. When evaluating whether to retrainnot self._fit_called
is always true.Expected behavior
forecasting models to respect the retrain parameter.
System (please complete the following information):
The text was updated successfully, but these errors were encountered: