How to make forecasts strictly positive?
See original GitHub issue- scikit-hts version: 0.5.5
- Python version: 3.6
- Operating System: Windows
Description
Want to make my predictions to be strictly positive. For that, I want to make use of the log transformation function and I’ve passed a custom transformation function to the transform parameter. The final results still have negative forecasts. I want to know if I’m passing the custom function correctly. If yes, want to know why the results are negative?.
I’ve created the custom function in 2 ways. Here goes the first one.
from collections import namedtuple
transform = namedtuple('transform', {'func': 'Callable', 'inv_func': 'Callable'})
transformer = transform(np.log1p, np.exp)
htsmodel = hts.HTSRegressor(model = 'auto_arima', revision_method = 'BU', n_jobs = 0, transform = transformer)
And the second one
transformer = hts._t.Transform(np.log1p, np.exp)
htsmodel = hts.HTSRegressor(model = 'auto_arima', revision_method = 'BU', n_jobs = 0, transform = transformer)
Unfortunately, None of them have any effect in bringing out the positive forecasts. So, Am I passing them the wrong way? or It’s something else.
PS: When I’m transforming them explicitly before fitting and back-transforming them after predictions. The forecasts are positive.
Issue Analytics
- State:
- Created 2 years ago
- Comments:6 (5 by maintainers)
Top Results From Across the Web
time series - How to achieve strictly positive forecasts?
5. One of the easiest, but not always correct thing to do in such case is simply forecast the log of the variable....
Read more >generate strictly positive values using arima.sim in R
This command give me both positive and negative values. r · forecasting · Share.
Read more >12.3 Ensuring forecasts stay within limits - OTexts
Positive forecasts. To impose a positivity constraint, simply work on the log scale, by specifying the Box-Cox parameter ...
Read more >Exponential smoothing and non-negative data
If the observational sample space is not restricted to be strictly positive, the. Class X models can have an infinite forecast variances ...
Read more >M5 Forecasting - Accuracy | Kaggle
The box cox method will ensure positive predictions but the input must be non negative and greater than 0. As for the nature...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@aakashparsi good catch, not sure how this passed the tests but the culprit is this:
Need to make an adjustment to the code, will lyk when it is in.
0.5.10 on the release pipeline: https://github.com/carlomazzaferro/scikit-hts/actions/runs/909157630