carlomazzaferro / scikit-hts

Hierarchical Time Series Forecasting with a familiar API
MIT License
222 stars 39 forks source link

Recursion Error #44

Open ghost opened 4 years ago

ghost commented 4 years ago

I cannot run more than two levels in local machine using Jupyter notebook. hierarchy = {total, state_h} --> works hierarchy = {total, state_h, **store_h} ---> fails with below error

print(sys.getrecursionlimit()) 3000


RecursionError Traceback (most recent call last)

in 3 df = df.resample("W").sum() 4 clf = HTSRegressor(model='prophet', revision_method='OLS', n_jobs=12) ----> 5 model = clf.fit(df, hierarchy) 6 7 preds = model.predict(steps_ahead=1) ~\Anaconda3\lib\site-packages\hts\core\regressor.py in fit(self, df, nodes, tree, exogenous, root, distributor, disable_progressbar, show_warnings, **fit_kwargs) 194 """ 195 --> 196 self.__init_hts(nodes=nodes, df=df, tree=tree, root=root, exogenous=exogenous) 197 198 nodes = make_iterable(self.nodes, prop=None) ~\Anaconda3\lib\site-packages\hts\core\regressor.py in __init_hts(self, nodes, df, tree, root, exogenous) 131 self.nodes = tree 132 else: --> 133 self.nodes = HierarchyTree.from_nodes(nodes=nodes, df=df, exogenous=exogenous, root=root) 134 self.exogenous = exogenous 135 self.sum_mat = to_sum_mat(self.nodes) ~\Anaconda3\lib\site-packages\hts\hierarchy\__init__.py in from_nodes(cls, nodes, df, exogenous, root, top, stack) 176 root=tmp_root, 177 top=top, --> 178 stack=stack) # pass tmp_root to the function as root 179 return top 180 ... last 1 frames repeated, from the frame below ... ~\Anaconda3\lib\site-packages\hts\hierarchy\__init__.py in from_nodes(cls, nodes, df, exogenous, root, top, stack) 176 root=tmp_root, 177 top=top, --> 178 stack=stack) # pass tmp_root to the function as root 179 return top 180 RecursionError: maximum recursion depth exceeded while calling a Python object
carlomazzaferro commented 3 years ago

Would you be able to post sample data for the example you're running? I'd like to reproduce locally to further debug

aakashparsi commented 3 years ago

@selenonel, I have faced a similar issue but increasing the recursion limit solved the problem. Now, I'm wondering is that a good practice to do? I think @carlomazzaferro may have an answer to this.