unit8co / darts

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

The function of historical forecast #2347

Closed pikawangwang closed 2 months ago

pikawangwang commented 2 months ago

I am a student trying to do time series forecasting.

When I am trying to using the function historical forecast with training set, I am confused about how the training loss is generated.

Is there a default fold of cross validaion, or the loss is generated by all of the training set?

Thank you!

madtoinou commented 2 months ago

Hi @pikawangwang,

You can find this information in the docstring of historical_forecasts() : "This method repeatedly builds a training set: either expanding from the beginning of series or moving with a fixed length train_length. It trains the model on the training set, emits a forecast of length equal to forecast_horizon, and then moves the end of the training set forward by stride time steps.

By default, this method will return one (or a sequence of) single time series made up of the last point of each historical forecast. This time series will thus have a frequency of series.freq * stride. If last_points_only is set to False, it will instead return one (or a sequence of) list of the historical forecasts series."

This method does not compute any loss/metric, but generate forecasts as if the model was fitted and called "from the past", to mimic historic/real-world usage of the model. Which can then be used to assess the model performance.

Does it make things clearer?

pikawangwang commented 2 months ago

@madtoinou Thanks for your explanation, I understand now😀