jdb78 / pytorch-forecasting

Time series forecasting with PyTorch
https://pytorch-forecasting.readthedocs.io/
MIT License
3.84k stars 608 forks source link

The only variable as input should be the target which is part of time_varying_unknown_reals #1570

Open Mohan16071996 opened 3 months ago

Mohan16071996 commented 3 months ago

My data set has : time_idx, Date, Ticker, Open, high, low, close, Stock split and Dividends. My Time series data set is: training = TimeSeriesDataSet( combined_data[lambda x: x.time_idx <= training_cutoff], time_idx="time_idx", target="Close", group_ids=["Ticker"], max_encoder_length=60, max_prediction_length=7, static_categoricals=["Ticker"], time_varying_known_reals=["time_idx", "Open", "High", "Low", "Volume", "Stock Splits", "Dividends"], time_varying_unknown_reals=["Close"], allow_missing_timesteps=True, target_normalizer=GroupNormalizer( groups=["Ticker"], transformation="softplus" ), add_relative_time_idx=False, add_target_scales=True, add_encoder_length=True, )

I get this error, when I run this :

Define the model with the suggested hyperparameters model = NBeats.from_dataset( training, learning_rate=learning_rate, hidden_size=hidden_size, widths=widths, backcast_loss_ratio=backcast_loss_ratio, dropout=dropout ) I see the data set has reals like encoder_length, Close_min, close_scaled and all time varying known reals I gave in the data set. I tried removing all the reals, still I get the error as number of reals are encoder, and Close related variables. I cannot not give encoder length. Issue arise from this piece of code:

assert ( len(dataset.flat_categoricals) == 0 and len(dataset.reals) == 1 and len(dataset.time_varying_unknown_reals) == 1 and dataset.time_varying_unknown_reals[0] == dataset.target ), "The only variable as input should be the target which is part of time_varying_unknown_reals"

Mohan16071996 commented 3 months ago

Can someone please update on this issue as soon as possible?