question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Use own trend model

See original GitHub issue

In the paper Forecasting at Scale by Sean J Taylor and Benjamin Letham, it says that prophet decomposes the timeseries using equation:

y(t) = g(t) + s(t) + h(t), where g is the trend model.

Is it possible to plug in our own trend model and use prophet only for s and h?

Issue Analytics

  • State:open
  • Created 5 years ago
  • Comments:23 (11 by maintainers)

github_iconTop GitHub Comments

1reaction
rquintinocommented, Sep 7, 2020

@bletham huge thx for the ProphetLastValue snippet, seems really what we were looking for, let us test asap and share feedback. We have been struggling with trend issues for short term forecasts (mostly kind of “lagging” behind), so will be really interesting to give this a try. again, thank you and all the team!

1reaction
blethamcommented, Sep 6, 2020

@pjebs I think there are two different types of custom trends that are getting a bit mixed up in the discussion here. One is to have a trend model that replaces the built-in piecewise-linear/piecewise-logistic trend, and is jointly fit along with the seasonalities in the same way the built-in trends are. That is, the trend model has parameters that will be fit by Prophet. In order to do this, things have to be changed inside the Stan model. #1466 provides a good example of how this can be done. This is sort of adjustment I think for the time being would be made in a fork.

What you’ve described is a little different; there is a trend provided by an external model that we wish to use in the place of the built-in trend. The difference is that the trend parameters do not need to be fit by Prophet. This is quite a bit simpler. With additive seasonality, this can actually be done now. Above I had proposed doing this by including the external trend as an external regressor. But, as noted above, this wasn’t entirely satisfactory because there was no way to prevent Prophet from adding extra trend on top of it until #614 was done. Well, as of the last version push (0.7.1), #614 is now done in Python! So what you would want to do is:

The reason this would work is because with additive seasonality, the Prophet model is

y(t) = trend(t) + seasonality(t) + beta * regressor(t) + noise

so here we would be setting trend(t) to be flat, and then beta * regressor(t) would be taken the place of the trend.

With multiplicative seasonality, the external trend would have to be used as the trend in the Stan model (and not a regressor), so it would require modification there.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to Use and Remove Trend Information from Time Series ...
In this tutorial, you will discover how to model and remove trend ... The dataset can be loaded with a custom date parsing...
Read more >
TREND function and other ways to do trend analysis in Excel
The tutorial shows how to use TREND function in Excel to calculate trends, how to project trend into the future, add a trendline,...
Read more >
13.3 Modeling Trend and Seasonality Using Regression
Such a fitted model is known as a quadratic trend model. Figure 13.24 shows the best-fitting quadratic trend model. In comparison to the...
Read more >
Add a trend or moving average line to a chart - Microsoft Support
For logarithmic, power, and exponential trendlines, Excel uses a transformed regression model. If you select Polynomial, type the highest power for the ...
Read more >
@TREND - Oracle Help Center
Calculates future values based on curve-fitting to historical values. The @TREND procedure considers a number of observations; constructs a mathematical model ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found