AutoViML / Auto_TS

Automatically build ARIMA, SARIMAX, VAR, FB Prophet and XGBoost Models on Time Series data sets with a Single Line of Code. Created by Ram Seshadri. Collaborators welcome.
Apache License 2.0
729 stars 114 forks source link

local variable 'forecast_df_folds' referenced before assignment #39

Closed ghost closed 3 years ago

ghost commented 3 years ago

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 commented 3 years ago

same error on Google Colab notebook.

GGA-PERSO commented 3 years ago

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

?

Baisalis commented 3 years ago

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

AutoViML commented 3 years ago

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 commented 3 years ago

Hi all: I have found the error and fixed it - please upgrade Auto-TS to the latest version by:

$ pip install auto-ts --upgrade

You should see version 0.0.36 and that should work. Thanks

Ram On Wednesday, February 3, 2021, 6:47:59 PM EST, Baisali Sant @.***> wrote:

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

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or unsubscribe.

ghost commented 2 years ago

I have just received this error again. Any advice?

radulucaciu commented 2 years ago

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 commented 1 year ago

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 commented 1 year ago

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

ravik4985 commented 1 year ago

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

image

cgobat commented 1 year ago

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

Fisixus commented 1 year ago

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

webcoderz commented 1 year ago

still getting error is this fix on a branch still?

AutoViML commented 1 year ago

Can you try upgrading to the latest version 0.71? I have made all the changes mentioned in this thread. AutoVimal  On Wednesday, April 12, 2023 at 12:06:10 PM EDT, webcoderz @.***> wrote:

still getting error is this fix on a branch still?

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.Message ID: @.***>