facebook / prophet

Tool for producing high quality forecasts for time series data that has multiple seasonality with linear or non-linear growth.
https://facebook.github.io/prophet
MIT License
18.4k stars 4.53k forks source link

Attribute Error for specified_changepoints when running cross_validation() #923

Closed jacob-adler closed 5 years ago

jacob-adler commented 5 years ago

I'm a little lost trying to figure out Prophet's diagnostics. Fitting model in a previous cell with interval_width=0.95 and a custom holidays dataframe that does not distinguish between holidays (just a flag like the playoffs df from the Peyton Manning example). Then running

from fbprophet.diagnostics import cross_validation
df_cv = cross_validation(model, initial = '365 days', period = '90 days', horizon = '30 days')

leads to the error

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-85-a50f3c0d9457> in <module>()
      1 from fbprophet.diagnostics import cross_validation
----> 2 df_cv = cross_validation(model, initial = '270 days', period = '90 days', horizon = '30 days')
      3 df_cv.head()

/usr/local/lib/python2.7/dist-packages/fbprophet/diagnostics.pyc in cross_validation(model, horizon, period, initial)
     93     for cutoff in cutoffs:
     94         # Generate new object with copying fitting options
---> 95         m = prophet_copy(model, cutoff)
     96         # Train model
     97         history_c = df[df['ds'] <= cutoff]

/usr/local/lib/python2.7/dist-packages/fbprophet/diagnostics.pyc in prophet_copy(m, cutoff)
    139         raise Exception('This is for copying a fitted Prophet object.')
    140 
--> 141     if m.specified_changepoints:
    142         changepoints = m.changepoints
    143         if cutoff is not None:

AttributeError: 'Prophet' object has no attribute 'specified_changepoints'

I made sure the model exists, but a little confused on what to look for next. Thanks!

jacob-adler commented 5 years ago

Wasn't able to figure out the cause, but uninstalled and reinstalled a few things and I'm not seeing the problem anymore.