Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error : Train TimeGradEstimator with ComplexSeasonalTimeSeries from GluonTS #173

Open
c1adrien opened this issue Jul 20, 2024 · 0 comments

Comments

@c1adrien
Copy link

Hello,

Thank you for your well-written code. I want to train TimeGrad with the data generated by GluonTS ComplexTimeSeries.

from gluonts.dataset.artificial import ComplexSeasonalTimeSeries
from gluonts.dataset.common import ListDataset

dataset  = ComplexSeasonalTimeSeries(
    num_series=10,
    prediction_length=21,
    freq_str="H",
    length_low=30,
    length_high=200,
    min_val=-10000,
    max_val=10000,
    is_integer=False,
    proportion_missing_values=0,
    is_noise=True,
    is_scale=True,
    percentage_unique_timestamps=1,
    is_out_of_bounds_date=True,
)

train_ds = ListDataset(dataset.train, freq=dataset.metadata.freq)

The metadata :

dataset.metadata
Output : MetaData(freq='H', target=None, feat_static_cat=[], feat_static_real=[], feat_dynamic_real=[], feat_dynamic_cat=[], prediction_length=21)

and I got

estimator = TimeGradEstimator(
    target_dim=1,
    prediction_length=dataset.metadata.prediction_length,
    context_length=dataset.metadata.prediction_length,
    cell_type='GRU',
    input_size=1484,
    freq=dataset.metadata.freq,
    loss_type='l2',
    scaling=True,
    diff_steps=100,
    beta_end=0.1,
    beta_schedule="linear",
    trainer=Trainer(device=device,
                    epochs=3,
                    learning_rate=1e-3,
                    num_batches_per_epoch=100,
                    batch_size=64,),
    max_idle_transforms=100,
)
predictor = estimator.train(dataset.train, num_workers=8)
Output : gluonts.exceptions.GluonTSDataError: Input for field "target" does not have the requireddimension (field: target, ndim observed: 1, expected ndim: 2)

I am not exactly sure how to fix the problem and I am having trouble understanding what target_dim expects. Indeed, this target_dim is not present in other models such as DeepAREstimator. Thank you in advance for your help!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant