Trying to create train/val/test DataSets (by date), for multiple TSs with different start dates #2674
Unanswered
yuvalarbel
asked this question in
Q&A
Replies: 1 comment 7 replies
-
Hi @yuvalarbel, this seems like a fairly generic task that should be easy to do, but maybe is not well covered by tooling/documentation currently. Let's take it step by step and see what may be missing: I'm assuming your data looks like the following, correct? (It's 10 series in my example) import pandas as pd
import numpy as np
from gluonts.dataset.pandas import PandasDataset
series = []
for k in range(10):
index = pd.period_range(
pd.Period("2000-01-03", freq="B") + 5 * k,
pd.Period("2023-01-31", freq="B")
)
series.append(pd.Series(np.random.uniform(size=len(index)), index=index))
dataset = PandasDataset(series)
print(dataset)
for entry in dataset:
print(entry) Is that accurate? If so, then the first step you can achieve with from gluonts.dataset.split import split
test_dataset = dataset
valid_dataset, _ = split(dataset, date=pd.Period("2019-12-31", freq="B"))
train_dataset, _ = split(dataset, date=pd.Period("2017-12-31", freq="B"))
for a, b, c in zip(train_dataset, valid_dataset, test_dataset):
print(f"{len(a['target'])} / {len(b['target'])} / {len(c['target'])}") |
Beta Was this translation helpful? Give feedback.
7 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi community!
I've been banging my head against the wall for many days, and still can't get this to work. I'd really appreciate any recommendations and help.
I have multiple time series, each beginning at different start times, from the year 2000 up until now (freq='B').
I would like to create a train/val/test split, with training data up until 2017, val up until 2019, and test up to now.
I then need to apply Transformations to these datasets.
Then, I'd like to create a torch DataLoader for each split, that returns randomly-positioned slices of (context_len, prediction_len). I'd like all windows, overlapping (distance/step_size=1).
I've tried many, many combinations of gluonts functions, but nothing has been working. Please give me your advice!
Thanks so much.
Beta Was this translation helpful? Give feedback.
All reactions