atspy icon indicating copy to clipboard operation
atspy copied to clipboard

UnboundLocalError: local variable 'periodocity' referenced before assignment

Open sr-ubuntu opened this issue 5 years ago • 3 comments

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

sr-ubuntu avatar Apr 25 '20 14:04 sr-ubuntu

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).

stefanosh avatar Apr 25 '20 15:04 stefanosh

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?

jtfields avatar Apr 28 '20 16:04 jtfields

Solution - https://github.com/firmai/atspy/issues/16

rahul4tripathi2 avatar Jun 08 '20 18:06 rahul4tripathi2