local variable 'forecast_df_folds' referenced before assignment
Vaderv opened this issue · 14 comments
Running into issue when running:
model.fit(
traindata=dataset,
# traindata=file_path, # Alternately, you can specify the file directly
ts_column=ts_column,
target=target,
cv=3,
sep=sep)
I get the error:
local variable 'forecast_df_folds' referenced before assignment
Exception occurred while building Prophet model...
Prophet object can only be fit once. Instantiate a new object.
FB Prophet may not be installed or Model is not running...
Traceback (most recent call last):
File "", line 33, in
model.fit(
File "C:\Users\myname\anaconda3\lib\site-packages\auto_ts_init_.py", line 506, in fit
self.ml_dict[name]['forecast'] = forecast_df_folds
UnboundLocalError: local variable 'forecast_df_folds' referenced before assignment
same error on Google Colab notebook.
auto_ts/init.py
not an expert but I think it should be
forecast_df_folds = None
instead of
forecasts = None
?
I am also getting the same error. Please let me know if you know how to fix that problem. Thanks in advance.
Hi Baisalis, Vaderv, Hurkaine and t1masavin:
I am sorry you are all getting this problem. The reason you get this error is that it is a catch-all error in case anything goes wrong with using your data to build a Facebook prophet model. So unless you can point me to the right Github notebook where you have your code or paste a sample of your data, I won't be able to fix it.
In addition, you can also send an email to rsesha2001 at gmail to get a copy of the notebook or colab file so I can look it over and fix if there are any problems with data or my code.
Also please try upgrading to the latest version. It usually has bug fixes that I find and I am also constantly testing it with new data sets and updating it.
$ pip install auto-ts --upgrade --user
Hope this helps,
Ram
I have just received this error again. Any advice?
Hi @AutoViML
I encountered the same error and traced it to using kwargs = {'iter':1e2}
on the following lines:
https://github.com/AutoViML/Auto_TS/blob/master/auto_ts/models/build_prophet.py#L234
https://github.com/AutoViML/Auto_TS/blob/master/auto_ts/models/build_prophet.py#L254
https://github.com/AutoViML/Auto_TS/blob/master/auto_ts/models/build_prophet.py#L566
The reason is that 1e2
evaluates (at least on SageMaker Linux) to 100.0 (float) and Prophet expects an int which raises the error above due to the try / catch above.
Once I changed the line to kwargs = {'iter':100}
it works as expected.
seeing the same issue
Time Interval is given as D
Correct Time interval given as a valid Pandas date-range frequency...
==================================================
Building Prophet Model
Running Facebook Prophet Model...
Fit-Predict data (shape=(2458, 2)) with Confidence Interval = 0.95...
Starting Prophet Fit
No seasonality assumed since seasonality flag is set to False
Starting Prophet Cross Validation
Max. iterations using expanding window cross validation = 5
Fold Number: 1 --> Train Shape: 2433 Test Shape: 5
Exception occurred while building Prophet model...
Column ds has timezone specified, which is not supported. Remove timezone.
FB Prophet may not be installed or Model is not running...
UnboundLocalError Traceback (most recent call last)
Cell In[20], line 7
1 forecast_df_folds=None
2 model = auto_timeseries(score_type='rmse',
3 time_interval='D',
4 non_seasonal_pdq=None, seasonality=False, seasonal_period=12,
5 model_type=['prophet'],dask_xgboost_flag=False,
6 verbose=2)
----> 7 model.fit(traindata, ts_column,target)
File ~/.local/lib/python3.9/site-packages/auto_ts/init.py:506, in auto_timeseries.fit(self, traindata, ts_column, target, sep, cv)
503 print(' FB Prophet may not be installed or Model is not running...')
505 self.ml_dict[name]['model'] = model
--> 506 self.ml_dict[name]['forecast'] = forecast_df_folds
507 self.ml_dict[name][self.score_type] = score_val
508 self.ml_dict[name]['model_build'] = model_build
UnboundLocalError: local variable 'forecast_df_folds' referenced before assignment
I have also encountered this problem. Have you solved this problem
Delete this part model_type='best' from "model = auto_timeseries(score_type='rmse')" this line.
This issue belongs to the Prophet model.
still getting error is this fix on a branch still?