unit8co / darts

A python library for user-friendly forecasting and anomaly detection on time series.
https://unit8co.github.io/darts/
Apache License 2.0
8.14k stars 886 forks source link

Understanding multiple-series training #668

Closed edvin-svk closed 2 years ago

edvin-svk commented 3 years ago

I'm confused as to what is actually happening when training a model on multiple series, as described in https://unit8co.github.io/darts/examples/02-multi-time-series-and-covariates.html where a model is trained on two different series. It is shown the prediction of one of the series is affected by including the other in the training. What is actually happening in such a training? How does training with model.fit([A, B]) differ from training model.fit(A, past_covariates=B) ?

dennisbader commented 3 years ago

Hi @edvinsav. When training with multiple TimeSeries model.fit([A, B]) the model uses both A and B as target series. Internally, the model then extracts samples from A and B to build the batches for training. This means that during training, losses are evaluated between predictions and actual historic data of both A and B -> the model is trained on both A and B.

When training with model.fit(A, past_covariates=B), A is the target series and the losses are only evaluated on A. B only serves only as a covariate - an explanatory variable that can help predictions of the target A but is never predicted itself.