Hello there, I am running experiment comparing gf...
# mlforecast
g
Hello there, I am running experiment comparing gfm (ml and dl), when I run models in mlforecast with lags like so...
Copy code
lgb_model = MLForecast(
    models=[lgb.LGBMRegressor(verbosity=-1,random_state=352, objective='mae')],
    freq='ME',
    lags=range(1,12),
    lag_transforms={
        1: [RollingMean(12), ExponentiallyWeightedMean(alpha=0.3)],
        12: [ExpandingMean()]
    },
    date_features=['month', 'year']
)
start_time = time()
lgb_model.fit(air_train, id_col='unique_id', time_col='ds', target_col='y', static_features=[])
lgb_time = time() - start_time
lgb_preds = lgb_model.predict(h=fh)
This seems correct from what I can see in the documentation and other examples. But I get the following error
Copy code
>>> lgb_model.fit(air_train, id_col='unique_id', time_col='ds', target_col='y', static_features=[])
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Users\.venv\Lib\site-packages\mlforecast\forecast.py", line 539, in fit
    prep = self.preprocess(
           ^^^^^^^^^^^^^^^^
  File "C:\Users\.venv\Lib\site-packages\mlforecast\forecast.py", line 251, in preprocess
    return self.ts.fit_transform(
           ^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\.venv\Lib\site-packages\mlforecast\core.py", line 541, in fit_transform
    return self._transform(
           ^^^^^^^^^^^^^^^^
  File "C:\Users\.venv\Lib\site-packages\mlforecast\core.py", line 386, in _transform
    features = self._compute_transforms(
               ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\.venv\Lib\site-packages\mlforecast\core.py", line 344, in _compute_transforms
    out = self.ga.apply_transforms(
          ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\.venv\Lib\site-packages\mlforecast\grouped_array.py", line 90, in apply_transforms
    results[tfm_name] = tfm.transform(core_ga)
                        ^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\.venv\Lib\site-packages\mlforecast\lag_transforms.py", line 53, in transform
    return self._core_tfm.transform(ga)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\.venv\Lib\site-packages\coreforecast\lag_transforms.py", line 86, in transform
    return ga._lag(self.lag)
           ^^^^^^^
AttributeError: 'GroupedArray' object has no attribute '_lag'
versions
Copy code
>>> print(f"mlforecast version: {mlforecast.__version__}")
mlforecast version: 1.0.1
>>> print(f"statsforecast version: {statsforecast.__version__}")
statsforecast version: 1.7.7.1
>>> print(f"coreforecast version: {coreforecast.__version__}")
coreforecast version: 0.0.12
Thanks for reading, let me know if other information would help
1
FYI - restarting my python interpreter (actually I reset VSCode) solved the issue.