luke14free / pm-prophet

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

question #6

Closed rds99 closed 6 years ago

rds99 commented 6 years ago

Hi How is this different from FBProphet? Is there some reference document available for this? Thanks

rds99 commented 6 years ago

I am working with some sensor reads that are collected every five seconds, a sample data set in enclosed, I tried FBProphet however am not able to find efficient parameters and also how much past data should be used to to fit model. I am more interested in knowing if the last read is towards the end of a peak or a trough. Any suggestions/thoughts on this? Many thanks sample-data-pmprophet.xlsx

twiecki commented 6 years ago

The readme states what's missing:

What's not yet implemented w.r.t. Facebook Prophet:

Multiplicative seasonality
Saturating growth
Uncertainty is not exactly estimated 1:1
Timeseries with non daily frequencies are untested (thus unlikely to work)
(potentially other things)
luke14free commented 6 years ago

@rds99 to do this, simply fit the model and read the trend component (update to 0.1.4 which fixes a few things). I guess sensors are not subject to seasonality so don't add them. When using simply the trend and the intercept the model then becomes a simple piecewise regression with normalization on the changepoints.

import pandas as pd

df = pd.read_excel("/Users/luca/Downloads/sample-data-pmprophet.xlsx")
df = df.head(180)

# Fit both growth and intercept
m = PMProphet(df, growth=True, intercept=True, n_changepoints=25, changepoints_prior_scale=0.2, name='model')

# Fit the model (using NUTS)
m.fit(method='NUTS')

m.plot_components(
    intercept=False,
)

You can then analyze the changepoints at various times (stored in m.trace['changepoints'])

download-46

Closing this for the moment, if you need more info feel free to re-open