Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dynamic CAP impacts TREND #1783

Closed
etesei opened this issue Jan 13, 2021 · 3 comments
Closed

Dynamic CAP impacts TREND #1783

etesei opened this issue Jan 13, 2021 · 3 comments

Comments

@etesei
Copy link

etesei commented Jan 13, 2021

Hello! I've noticed that when I try to implement a cap that increases with the time series, there is an immediate uptick in the forecasted trend, essentially matching the trend to the cap. Is there a way to mitigate this effect? My goal is to have a smooth trend that saturates at a gradually increasing limit.

Thanks for any and all advice!

@sss-ng
Copy link
Contributor

sss-ng commented Jan 13, 2021

I haven't this in my usage of prophet. Could you post an example with data so we can see what you mean and play around with it a little bit?

@bletham
Copy link
Contributor

bletham commented Jan 14, 2021

The logistic growth trend is

trend(t) = C / (1 + exp(-m(t - b)))

Basically m is the rate at which the trend saturates to C, starting from offset b.

Now if you turn C into C(t), you can see that a step change in C(t) will produce a stepchange in trend(t). I think the right way to think about the logistic trend is that what is growing with rate k is the fraction of C that has been achieved: 1/(1 + exp(-m(t - b))), which saturates at 1. Think of that as the level of saturation. If we increase the C, we're still at the same level of saturation.

My experience is that this can work fine with a capacity that grows linearly, but certainly with large changes it won't be an appropriate model.

So what can be done about this and is there a more reasonable way to have the forecast saturate at a not-constant level. I haven't explored this issue much myself so I'm not sure I have any great suggestions. But I think the issue does have some connection to that in #1668, which is about having forecasts that saturate at 0. Here you would just replace a lowerbound of 0 with an upperbound that is the dynamic capacity. I would recommend trying approaches 1 and 5 from that issue. Approach 1 is basically to just clip the predictions at the capacity. It will certainly then saturate at that level. It will also never come back down, which may or may not be reasonable depending on what saturation means for the time series. If you think there is a chance that the time series will come back down after reaching the saturation point, then Approach 5 would allow that by basically changing the trend model to one that disallows future trend changes that take you above the cap (but still allowing future trend changes that take you back down). The trend code there would probably need a bit of tweaking for a not-constant function, but the idea would work. If you try out either of these I'd be really interested to hear how it goes.

@etesei
Copy link
Author

etesei commented Jan 14, 2021

Appreciate the responses! The key piece I am seeing in the code is that the Cap must not have a step function change when the forecasted period begins. Seeing great results now that I am just growing off of a reasonable base cap.

Thank you!

@bletham bletham closed this as completed Apr 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants