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.11k stars 884 forks source link

[BUG] create_lagged_component_names does not return target column names #2574

Closed ETTAN93 closed 3 weeks ago

ETTAN93 commented 1 month ago

image

From the documentation above, the function create_lagged_component_names is supposed to return the names of the target columns. However, when I run the function below, I get back an empty list:

from darts.utils.data.tabularization import create_lagged_component_names, create_lagged_training_data, create_lagged_prediction_data
target_lags = None
past_cov_lags = list(range(-8, 0))
future_cov_lags = list(range(-22, 21))

lagged_data_component_names = create_lagged_component_names(
    target_series=hf_data_dict['target_fit'],
    past_covariates=hf_data_dict['past_cov_fit'],
    future_covariates=hf_data_dict['future_cov_fit'],
    lags=target_lags,
    lags_past_covariates=past_cov_lags,
    lags_future_covariates=future_cov_lags,
    output_chunk_length=3,
    use_static_covariates=False
)
lagged_data_component_names[1]

This what my target_fit, past_cov_fit and future_cov_fit looks like: image image

As far as I understand the last n (forecast_horizon) names in lagged_data_component_names[0][-forecast_horizon:] should be equivalent to the output in lagged_data_component_names[1]?

Since my target name is edm_power_feed_in_diffand my output_chunk_length=3, I would expect create_lagged_component_names[1] to return[edm_power_feed_in_diff_hrz1, edm_power_feed_in_diff_hrz2, edm_power_feed_in_diff_hrz3] ?

dennisbader commented 4 weeks ago

Hi @ETTAN93 , it's indeed a bug that happens when lags=None (target lags). I'll open a fix soon.