Open xiaoyaoyang opened 1 year ago
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 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 ?
Just give the argument estimator_list=['arima', 'sarimax', 'holt-winters']
to the fit()
method
thanks for reply!! the reason why I choose tree model is I need interpretation and want to use SHAP afterward.