wwrechard / pydlm

A python library for Bayesian time series modeling
BSD 3-Clause "New" or "Revised" License
475 stars 98 forks source link

problem with longSeason: updateEvaluation() takes 2 positional arguments but 3 were given #43

Closed janbolmer closed 4 years ago

janbolmer commented 4 years ago

I have a simple model with one data point for each hour, I have a daily season (24 hours) and a weekly season 7 periods a 24 hours.

        data = df["avg"] # just a column of a pandas DataFrame
        bsts = dlm(data)
        # A linear trend
        bsts = bsts + trend(degree=1, discount=0.95, name='linear_trend', w=10)
        bsts = bsts + seasonality(period=24, discount=0.99, name='seasonal24', w=10)
        bsts = bsts + longSeason(data=data, period=7, stay=24, discount=0.99, name='seasonal7', w=100)

which produces the following error:

Initializing models...
Traceback (most recent call last):
  File "bsts.py", line 121, in <module>
    group_by_test()
  File "bsts.py", line 54, in group_by_test
    bsts.fit()
  File "/Applications/anaconda3/lib/python3.7/site-packages/pydlm/dlm.py", line 283, in fit
    self.fitForwardFilter()
  File "/Applications/anaconda3/lib/python3.7/site-packages/pydlm/dlm.py", line 185, in fitForwardFilter
    self._initialize()
  File "/Applications/anaconda3/lib/python3.7/site-packages/pydlm/func/_dlm.py", line 150, in _initialize
    self.builder.initialize(noise=self.options.noise, data=self.padded_data)
  File "/Applications/anaconda3/lib/python3.7/site-packages/pydlm/modeler/builder.py", line 277, in initialize
    comp.updateEvaluation(0, data)
TypeError: updateEvaluation() takes 2 positional arguments but 3 were given

Am I using longSeason correctly?

jesuinovieira commented 4 years ago

Did you download pydlm from pypi? If yes, you must get the lastest version from github as written in the README.

You can get the package (current version 0.1.1.11) from pypi by

    $ pip install pydlm

You can also get the latest from github

    $ git clone git@github.com:wwrechard/pydlm.git pydlm
    $ cd pydlm
    $ sudo python setup.py install
janbolmer commented 4 years ago

This worked, thank you! Is it possible to get the current (working) version on PyPi?