Live data from Hacker News

Ask HN: Data Scientists, what libraries do you use for timeseries forecasting?

news.ycombinator.com

11–20 of 91 posts

Re: Ask HN: Data Scientists, what libraries do you use for timeseries forecasting?

#11

I was told to start with XGBoost. Is Prophet better?

Xgboost is a classifier for tabular data, prophet is for time series prediction. They are different use cases, though you can likely massage xgboost to do time series prediction if you really wanted to. So the question of which is better is "it depends"

Time delay embedding (i.e. the observed value at different time lags as a feature) is the usual trick to turn time series data into a tabular form for this sort of regression.

Re: Ask HN: Data Scientists, what libraries do you use for timeseries forecasting?

#15

I was told to start with XGBoost. Is Prophet better?

Xgboost is a classifier for tabular data, prophet is for time series prediction. They are different use cases, though you can likely massage xgboost to do time series prediction if you really wanted to. So the question of which is better is "it depends"

You can use XGBoost for both classification and regression. See https://xgboost.readthedocs.io/en/stable/python/python_api.h...

Re: Ask HN: Data Scientists, what libraries do you use for timeseries forecasting?

#16

Earlier quoted context omitted.

Xgboost is a classifier for tabular data, prophet is for time series prediction. They are different use cases, though you can likely massage xgboost to do time series prediction if you really wanted to. So the question of which is better is "it depends"

I'm not even sure how you can get it to work on time series...

Create features for day of week, day of year, month of year, lagged values of y, lagged values of y for each period (eg: 1, 2, 3 weeks and years ago etc). You then predict forward 1 time step at a time.

Re: Ask HN: Data Scientists, what libraries do you use for timeseries forecasting?

#18

Forecast package in R is quite useful. Even if you don’t use R, this book by Rob Hyndman is very approachable and easy to follow. https://otexts.com/fpp2/

+1 for the book, an excellent reference. As someone who's primarily a developer, it's been extremely useful as a study guide.

Also, there's a new version; s/2/3 :)

Re: Ask HN: Data Scientists, what libraries do you use for timeseries forecasting?

#19
Can you reframe the problem to suit a more classical approach - regression using xgboost or lgbm? If so, go for that!

As an example, imagine you want to calculate only a single sample into the future. Say furthermore that you have six input timeseries sampled hourly, and you don't expect meaningful correlation beyond 48h old samples.

You create 6x48 input features, take the single target value that you want to predict as output, and feed this into your run of the mill gradient boosted tree.

The above gives you a less complex approach than reaching for bespoke time-series stuff; I've personally have had success doing something like this.

If your regressor does not support multiple outputs, you can always wrap it in sklearns MultiOutputRegressor (or optionally RegressorChain; check it out). This is useful if, in the above example, you are not looking to predict only the next sample, but maybe the next 12 samples.

https://scikit-learn.org/stable/modules/generated/sklearn.mu...

Re: Ask HN: Data Scientists, what libraries do you use for timeseries forecasting?

#20
Easiest is to use cvxpy with your own objective function. You can easily add seasonality regularization etc. other things are too much black box. Also pivot tables. They are free now in online version of google sheets and online excel. Set the time as a row field and it will automatically aggregate. Or if you want irregular spacing you can group by 100 samples.
Post reply on HN