antoinecarme / pyaf

PyAF is an Open Source Python library for Automatic Time Series Forecasting built on top of popular pydata modules.
BSD 3-Clause "New" or "Revised" License
459 stars 72 forks source link

Add a Jupyter Notebook to demonstrate the use of Grouped Forecasting #55

Closed tomaszb closed 7 years ago

antoinecarme commented 7 years ago

Hi,

This isssue is similar to issue #9. WIP.

Need to adapt the example in issue #9 to use grouped hierarchies. Grouping is a special hierarchy. The only difference is in the way the hierarchy is defined and built.

antoinecarme commented 7 years ago

sample test scripts with grouped hierarchies here :

https://github.com/antoinecarme/pyaf/tree/master/tests/hierarchical

tomaszb commented 7 years ago

Great! Thanks for the update and the link to the test scripts. I did not notice that directory earlier.

antoinecarme commented 7 years ago

All pyaf aspects are (expected to be) tested and a test script is available ... a grep can help.

You can test the status of the build tests here (run after each commit) :

https://travis-ci.org/antoinecarme/pyaf

grouped hierarchies tests passed the last time ;)

antoinecarme commented 7 years ago

@tomaszb

I just added the notebook you requested. Thanks to your issue, I corrected also some small glitches with plotting. You mean need to upgrade you install.

tomaszb commented 7 years ago

@antoinecarme Thanks for the quick response! Will do an upgrade on the package and will take a look.

antoinecarme commented 7 years ago

You are welcome. Enjoy!

tomaszb commented 7 years ago

Unfortunately there is an issue in the Grouped Notebook example. When creating the hierarchy with the call:

lSignalHierarchy = lEngine.plot_Hierarchy(French_Wine_Export_in_Euros_DF , "Month", "Signal", 1, lHierarchy, None);

I get the error:

AttributeError Traceback (most recent call last)

in () 5 6 lSignalHierarchy = lEngine.plot_Hierarchy(French_Wine_Export_in_Euros_DF , "Month", "Signal", 1, ----> 7 lHierarchy, None); /usr/local/lib/python3.6/site-packages/pyaf/HierarchicalForecastEngine.py in plot_Hierarchy(self, iInputDS, iTime, iSignal, iHorizon, iHierarchy, iExogenousData) 86 lSignalHierarchy = self.create_signal_hierarchy(iInputDS, iTime, iSignal, iHorizon, iHierarchy, iExogenousData); 87 lSignalHierarchy.create_HierarchicalStructure(); ---> 88 lSignalHierarchy.plot(); 89 return lSignalHierarchy; 90 /usr/local/lib/python3.6/site-packages/pyaf/TS/SignalHierarchy.py in plot(self, name) 201 start_time = time.time() 202 lAnnotations = None; --> 203 lHasModels = (self.mModels is not None) 204 if(lHasModels): 205 lAnnotations = {}; AttributeError: 'cSignalGrouping' object has no attribute 'mModels'
antoinecarme commented 7 years ago

@tomaszb

This was the object of the first commit (failure when plotting)

https://github.com/antoinecarme/pyaf/commit/1de5d2418bf34b8f3bb7ba84cae954bd0c56da85

The line with __init__(self) corrects this.

Are you sure that this line is present in your version ?

antoinecarme commented 7 years ago

An upgrade is needed.

pip install --upgrade git+git://github.com/antoinecarme/pyaf.git

Can you please try un-installing and installing PyAF (the hard way ;) ?

antoinecarme commented 7 years ago

@tomaszb

Can you please tell me if you were able to use the notebook ?

tomaszb commented 7 years ago

@antoinecarme Sorry for the delay. After reinstalling correctly I was able to get the GroupedSignals notebook to work. Thank you for the follow up.

antoinecarme commented 7 years ago

thanks @tomaszb. enjoy!