Closed mgiangreco closed 6 years ago
No, we cannot force the signal to be positive in the engine (for the moment). A forecast post-processing is an option, as you mentioned.
Do you have a sample code that reproduces this ? I suppose/hope that the error is still acceptable.
Some signal transformations (log) force the signal to be positive at the end, by design. You can activate these (not the default).
I'll see if I can get permission to share some anonymized data. I think the issue comes into play when the model chosen by PyAF has a negative sloping trend and a long prediction horizon. In that case the forecast can dip into negative.
This is usually needed when the signal values are expected to positive (counts etc).
Think also of a way to force something like this to be always positive :
Here, there are a few points where the forecast is negative.
by applying a "relu" rectifier (commonly used in ANNs, https://en.wikipedia.org/wiki/Rectifier_(neural_networks)), one can get the desired forecast, something like :
lEngine2.mOptions.mForecastRectifier = "relu"
The negative forecasts can now be removed (set to zero) using the training option :
cForecastEngine.mOptions.mForecastRectifier = "relu"
Is there a way to tell the engine that predictions cannot be negative? Obviously it is possible to change negative predictions to zero after the fact...