FLAML icon indicating copy to clipboard operation
FLAML copied to clipboard

When use ts_forecast with lgb, 2 more lags, results looks like just shift of series itself.

Open xiaoyaoyang opened this issue 1 year ago • 4 comments

  1. How exactly ts_forecast + lgb/ xgboost works? I looked it up in code seems it leverage https://hcrystalball.readthedocs.io/en/latest/, is there a documentation that introduce exactly what each parameters does and how those thing work together?
  2. I am also trying to understand what 1) Optimize_for_horizon 2) lags 3) retrain_full means. For example, retrain_full I would expect the model use full train+test dataset, with tuned parameters and train the model at the end, is that the case? (Sorry if it's already in documentation, I did not find it)
  3. I am seeing some strange behavior when lags>1 with loss MAPE, specifically the predicted series would looks just like a shift of original series, chart show below.
image

xiaoyaoyang avatar Apr 19 '23 05:04 xiaoyaoyang

hcrystalball just collects lagged values of the series and feeds them as features to a sklearn model, treating the next value as the target. lags is just the number of lags it takes, and if you choose optimize_for_horizon=True, it fits not just one model, but a series of models for predicting different number of days ahead.

retrain_full=True (recommended) means that initially you hold back the final chunk of the train set to use as validation for hyperparameter tuning, but once you've chosen a model and hyperparameter set, you retrain using those on the whole training set. This is especially important as many time series models must be trained on all in-sample data to predict out of sample.

The behavior you're seeing is just that the fit didn't converge that well, namely the best solution it's been able to find is very close to just using the value N periods ago as the forecast for the value right now.

Why do you restrict yourself to lgb/xboost solvers anyway? As often as not, I find classics like SARIMA-X to perform quite well, or perhaps the recently added Holt-Winters.

Finally, the time series in the plot is just quite hard to predict. It seems to be essentially noise with occasional random spikes - I'd be surprised if any method was particularly good at forecasting that.

ZmeiGorynych avatar May 09 '23 12:05 ZmeiGorynych

@ZmeiGorynych Why do you restrict yourself to lgb/xboost solvers anyway? As often as not, I find classics like SARIMA-X to perform quite well, or perhaps the recently added Holt-Winters may you share code example please ?

Sandy4321 avatar Jul 30 '23 22:07 Sandy4321

Just give the argument estimator_list=['arima', 'sarimax', 'holt-winters'] to the fit() method

ZmeiGorynych avatar Aug 02 '23 06:08 ZmeiGorynych

thanks for reply!! the reason why I choose tree model is I need interpretation and want to use SHAP afterward.

xiaoyaoyang avatar Aug 23 '23 16:08 xiaoyaoyang