This message was deleted.
# neural-forecast
s
This message was deleted.
b
You could log it before feeding into the model and then exponentiate after--applies to any model, I think. See here for some technical info (for R fable) that explains: https://otexts.com/fpp3/limits.html
👍 1
l
Thanks @Brian Head for the suggestion. Log transform requires >0 values. What would your suggestions if input data contains <= 0 values? I know common practice eg set 0.000001 very small values for 0 values.
c
Hi @lobbie lobbie. Any reason why you want to limit the forecast to above 0 if your data allows for lower values? Additional to Brian suggestion one simple thing you can do is replacing the negative values yourself with 0. The only way to natively having non-zero predictions is using a Possion distribution loss, but that also requires to pass non-negative values.
👍 1
l
Hi @Cristian (Nixtla), the primary reason is I am forecasting sales qty for items and the business is going to use the forecasts in supply chain situations. Having negative forecasts do not make business sense for planning, although we have sales returns. The other issue I faced is the horizon predictions from NFC models are < 0 not for 1 week but for a few subsequent weeks. Clipping to 0s for these subsequent weeks also do not make business sense, and from sales analysis, we sell > 1 pcs for an item each week. I may need to set appropriate floor and ceiling for each item to ensure the forecasts from NFC models do not go insanely low or high. But this is not an easy task because we have more than 10k items and each item behaves differently even with those in the same category. i suspect the negative forecast and insane large forecast is somewhat also related to scaling, which i have another discussion on.
c
Thanks for all the details! The negative forecasts might not be related with the large forecasts necessarily. If your recent historic data for a product has many negative values, it will also forecast negative values. This is because the model is learning to forecast the time series you are providing. It seems that you are passing net sales to forecast "gross sales" (without returns). Can you try modifying your input to reflect this?
I would be happy to deep dive in the issues if you can provide some anonymized examples of the time series.
l
@Cristian (Nixtla), merry christmas and a happy new year. It would be difficult for me to reproduce anonymized examples from my dataset and will take some time to do that. Thanks for your offer and support. after more research, I am going to take up Brian's suggestion to clip <=0 values in the target to a very small value 0.0000001. I also suspect I did cube root to stablise the variance after scaling is the cause of the large fcast values. since nfc does not do scaling if not specified, then my scaling and reverse scaling should not be an issue. my new steps are clip(lower=0-> cube root -> min max scale -> fit -> predict -> reverse min max scale -> cube.