prophet icon indicating copy to clipboard operation
prophet copied to clipboard

The following forecast values are less than previous ones

Open beloteloff opened this issue 9 years ago • 4 comments

I have a data, which have accumulative nature: financial index. The indicator must constantly grow or similiar to previous value;It's meaning that values in time series can't fall. In the prediction I have value for (x+1) element less than x or (x-1). What you can recommend me for fixing this problem? Thanks!

beloteloff avatar Apr 03 '17 08:04 beloteloff

This is an interesting problem. I'd suggest fitting Prophet to the difference of your data (numpy.diff in Python, or diff in R), and then computing the cumulative sum of the forecast (yhat in the forecast dataframe) afterwards.

It is still possible that the forecast for the diff would be negative, which would mean the cumulative sum decreases. You could either rectify all of the forecasted values to be >=0 (set the negative values equal to 0), or you could do the forecasting in a log-scale which would ensure positivity. I would guess that rectifying would work well but it probably depends on the time series.

bletham avatar Apr 04 '17 23:04 bletham

Yes, I did it, using numpy.diff. This is a open problem for predicting ever-increasing time series

beloteloff avatar Apr 05 '17 08:04 beloteloff

Did it work well enough? I'm not sure that this is something we will build automatic support in for since I suspect the right way to do this will be pretty problem specific.

bletham avatar Apr 05 '17 17:04 bletham

I'm going to close this out since I don't think we're going to tackle this specific problem anytime soon.

bletham avatar Apr 14 '17 07:04 bletham