-
Notifications
You must be signed in to change notification settings - Fork 752
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
Irregular time series support #1973
base: dev
Are you sure you want to change the base?
Conversation
To understand it correctly, "irregular" means that the values are not spaced apart by the same time offset? |
right! Which then implies we need to specify the time index for each point of the target... I believe i have training working... stuck at the inference part... I would appreciate some help! Let me push the latest changes and example to test... |
@jaheba I am using the following snippet to test: import random
import pandas as pd
from gluonts.dataset.common import Dataset, ListDataset
from gluonts.torch.model.deepar import DeepAREstimator
from gluonts.evaluation import make_evaluation_predictions, Evaluator
freq_str="1T"
prediction_length = 10
index = sorted(random.sample(list(pd.date_range("2021-01-01 02:12:06",
periods=400,
freq=freq_str)), 50+prediction_length))
train_ds = ListDataset(
[
{
"start": index[0],
"target": [float(i) for i in range(50)],
"item_id": "0",
"index": index[:50],
},
],
freq=freq_str,
)
test_ds = ListDataset(
data_iter=[
{
"start": index[0],
"target": [float(i) for i in range(50+prediction_length)],
"item_id": "0",
"index": index[:50+prediction_length],
}
],
freq=freq_str,
)
estimator = DeepAREstimator(
freq=freq_str,
prediction_length=prediction_length,
scaling=False,
trainer_kwargs={"max_epochs": 1},
)
predictor = estimator.train(train_ds)
forecast_it, ts_it = make_evaluation_predictions(
dataset=test_ds,
predictor=predictor
)
forecasts = list(forecast_it)
tss = list(ts_it)
evaluator = Evaluator()
agg_metrics, ts_metrics = evaluator(iter(tss), iter(forecasts), num_series=len(test_ds)) |
Can we add the snippet as a test? |
sure... let me do that... |
Something I'm wondering: If we merge this PR we break the assumption that time-series are regular. Is that an assumption we rely on in other places? /cc @lostella |
as long as there is no
Apart from that I do not believe there is anything else relying on this assumption... (as far as I can tell) |
so the one big missing piece is in the |
@rsnirwan would you have some time to quickly see how I can also use the new pandas datasets with irregular time indices in this PR? |
f442a8e
to
afcaf9f
Compare
hmm @AjinkyaBankar kind-of, things were refactored and this branch kind of got left behind... i would love to get it up to speed but it might require a new PR |
@kashif I am excited to use this as soon as possible. Let me know if I can help with this. |
Issue #, if available:
Description of changes:
Adding support to irregular time series where the datatimes are given by an
INDEX
key in the datasetBy submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.
Please tag this pr with at least one of these labels to make our release process faster: BREAKING, new feature, bug fix, other change, dev setup