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.09k stars 881 forks source link

[QUESTION] Do samples from multivariate quantile regression forecast represent joint distribution? #2595

Closed bmwilly closed 1 day ago

bmwilly commented 3 days ago

Hello, and thank you for the great library.

Describe the issue linked to the documentation

I have a clarifying question. I have a multivariate (multiple components) quantile regression forecaster (ex: XGBModel(likelihood='quantile', ...)).

When using predict(), I can get the predicted quantiles directly (using predict_likelihood_parameters=True) or samples (using n_samples > 1).

My question: do these samples represent the marginal distributions of each component, or do they represent the joint distribution?

I would assume the former given how the quantile regression is constructed, but I wanted to verify.

Thanks in advance!

Additional context

I have read the documentation, the example notebooks, some of the source code, and related issues (ex: https://github.com/unit8co/darts/issues/2481, https://github.com/unit8co/darts/issues/2066), but I have not found a clear answer to this question.

dennisbader commented 1 day ago

Hi @bmwilly, for XGBModel, a dedicated model is used and trained for:

So the quantile output is trained for each component individually.

However, all dedicated models receive the same input features (lagged features of all target and covariates components).

The sampling is also done for each component individually (see below)

https://github.com/unit8co/darts/blob/bb2499939f7665dc8ac38fd2ae6a5c9929a345f8/darts/models/forecasting/regression_model.py#L1525

Hope this helps, let me know if you need further info.

bmwilly commented 1 day ago

@dennisbader

The sampling is also done for each component individually (see below)

This is the part I was missing. That comment — plus reading the docstring and source code for _sampling_quantile — clears it up.

Thank you!