Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

local variable 'forecast_df_folds' referenced before assignment #39

Closed
Vaderv opened this issue Jan 25, 2021 · 14 comments
Closed

local variable 'forecast_df_folds' referenced before assignment #39

Vaderv opened this issue Jan 25, 2021 · 14 comments

Comments

@Vaderv
Copy link

Vaderv commented Jan 25, 2021

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

@t1masavin
Copy link

same error on Google Colab notebook.

@GGA-PERSO
Copy link

auto_ts/init.py
not an expert but I think it should be
forecast_df_folds = None
instead of
forecasts = None

?

@Baisalis
Copy link

Baisalis commented Feb 3, 2021

I am also getting the same error. Please let me know if you know how to fix that problem. Thanks in advance.

@AutoViML
Copy link
Owner

AutoViML commented Mar 3, 2021

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

@AutoViML AutoViML pinned this issue Mar 3, 2021
@AutoViML
Copy link
Owner

AutoViML commented Mar 14, 2021 via email

@ghost
Copy link

ghost commented May 5, 2022

I have just received this error again. Any advice?

@radulucaciu
Copy link

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.

@satroutr
Copy link

satroutr commented Dec 7, 2022

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

@MasterMiao919
Copy link

I have also encountered this problem. Have you solved this problem

@ravik4985
Copy link

Getting error local variable 'forecast_df_folds' referenced before assignment. can somebody suggest a resolution upgrading auto-ts not helping.

image

@cgobat
Copy link
Contributor

cgobat commented Mar 27, 2023

For future visitors to this thread: #98 resolved this issue.

@Fisixus
Copy link

Fisixus commented Mar 29, 2023

Delete this part model_type='best' from "model = auto_timeseries(score_type='rmse')" this line.
This issue belongs to the Prophet model.

@webcoderz
Copy link

still getting error is this fix on a branch still?

@AutoViML
Copy link
Owner

AutoViML commented May 17, 2023 via email

@AutoViML AutoViML unpinned this issue May 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests