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

UnboundLocalError: local variable 'periodocity' referenced before assignment #14

Open
sr-ubuntu opened this issue Apr 25, 2020 · 3 comments

Comments

@sr-ubuntu
Copy link

Hi,

A very interesting project, really appreciate it.
Got the below error while giving it a try, please help

<class 'pandas.core.frame.DataFrame'>
The data has been successfully parsed by infering a frequency, and establishing a 'Date' index and 'Target' column.
140
An insample split of training size 140 and testing size 47 has been constructed

UnboundLocalError Traceback (most recent call last)
in
----> 1 forecast_in, performance = am.forecast_insample(); forecast_in

~/anaconda3/envs/srtest/lib/python3.6/site-packages/atspy/init.py in forecast_insample(self)
845
846 def forecast_insample(self):
--> 847 models_dict, freq, test = self.train_insample()
848 forecast_len = test.shape[0]
849 forecast_dict = forecast_models(models_dict, forecast_len, freq,test, in_sample=True, GPU=self.GPU)

~/anaconda3/envs/srtest/lib/python3.6/site-packages/atspy/init.py in train_insample(self)
834 train, test = train_test_split(dataframe, train_proportion=0.75)
835 forecast_len = len(test)
--> 836 models, seasonal = train_models(train, models= self.model_list,forecast_len= forecast_len,full_df=dataframe,seasonality=self.season,in_sample=True,freq=freq, GPU=self.GPU )
837 self.seasonality = seasonal
838

~/anaconda3/envs/srtest/lib/python3.6/site-packages/atspy/init.py in train_models(train, models, forecast_len, full_df, seasonality, in_sample, freq, GPU)
317 seasons = select_seasonality(train, seasonality)
318
--> 319 periods = select_seasonality(train, 'periodocity')
320
321 models_dict = {}

~/anaconda3/envs/srtest/lib/python3.6/site-packages/atspy/init.py in select_seasonality(train, season)
149 def select_seasonality(train, season):
150 if season == "periodocity":
--> 151 seasonality = infer_periodocity(train)
152 elif season== "infer_from_data":
153 seasonality = infer_seasonality(train)

~/anaconda3/envs/srtest/lib/python3.6/site-packages/atspy/init.py in infer_periodocity(train)
145 periodocity = 1000
146
--> 147 return periodocity
148
149 def select_seasonality(train, season):

UnboundLocalError: local variable 'periodocity' referenced before assignment

@stefanosh
Copy link

I have experienced the same error when using sub-daily time series data such as hourly data etc. For example data with frequencies of the following: "3H", "5T" (minutes).

@jtfields
Copy link

I didn’t see this issue and posted a new one this morning. I’m trying to use annual data (2007, 2008, etc) and I get the same error. I wonder if there is a way to specify the frequency and not have AtsPy infer it?

@rahul4tripathi2
Copy link

Solution - #16

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

4 participants