luke14free / pm-prophet

GAM timeseries modeling with auto-changepoint detection. Inspired by Facebook Prophet and implemented in PyMC3
325 stars 42 forks source link

UnboundLocalError: local variable 'w' referenced before assignment #16

Closed clausherther closed 5 years ago

clausherther commented 5 years ago

I tried to run a very simple model with weekly data from a pandas dataframe and get the below error. I'm not sure how to troubleshoot this. I get the same error if I add more explicit params for changepoints etc.

FYI, this exact dataset has been fit with fbprophet successfully.

Version: pmprophet-0.2 Python: Python 3.6.7

m = PMProphet(df_city, name='model')
m.fit(method='NUTS')
~/.pyenv/versions/3.6.7/lib/python3.6/site-packages/pmprophet/model.py in generate_priors(self)
    243                 else:
    244                     k = len(self.changepoints)
--> 245                 cgpt = pm.Deterministic('cgpt', w * pm.Laplace('cgpt_inner', 0, self.changepoints_prior_scale, shape=k))
    246                 self.priors['changepoints'] = pm.Deterministic('changepoints_%s' % self.name, cgpt)
    247             if self.intercept and 'intercept' not in self.priors:

UnboundLocalError: local variable 'w' referenced before assignment
luke14free commented 5 years ago

This should be fixed in 0.2.1, let me know if the issue persists

clausherther commented 5 years ago

Ah, I see, thanks! Yes, this error went away, but now I get a different one (opening a separate issue).