deepjavalibrary / deepjavalibrary/djl

TimeSeries API Bugs (frequency, context length, FEAT_DYNAMIC_REAL)

Open
#3,271 6 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
Java
Stars
4.9k
Forks
759
Avg merge
19h 26m
Merged PRs (30d)
17

Description

If we specify the frequency as required by the Lag class or as the GluonTS documentation says,
![image](https://github.com/deepjavalibrary/djl/assets/158003379/ff34d367-8ebc-401f-90e4-5b52d7e1d11f)
for example "1H", "H", "15min", we will get an exception:
```
Exception in thread "main" java.time.format.DateTimeParseException: Text cannot be parsed to a Duration
at java.base/java.time.Duration.parse(Duration.java:419)
at ai.djl.timeseries.transform.feature.Feature.addTimeFeature(Feature.java:127)
at ai.djl.timeseries.transform.feature.Feature.addTimeFeature(Feature.java:75)
at ai.djl.timeseries.transform.feature.AddTimeFeature.transform(AddTimeFeature.java:63)
at ai.djl.timeseries.dataset.TimeSeriesDataset.apply(TimeSeriesDataset.java:105)
at ai.djl.timeseries.dataset.TimeSeriesDataset.get(TimeSeriesDataset.java:60)
at ai.djl.training.dataset.DataIterable.fetch(DataIterable.java:170)
at ai.djl.training.dataset.DataIterable.next(DataIterable.java:145)
at ai.djl.training.dataset.DataIterable.next(DataIterable.java:43)
at ai.djl.training.EasyTrain.fit(EasyTrain.java:54)
```
or
```
Exception in thread "main" java.time.format.DateTimeParseException: Text cannot be parsed to a Period
at java.base/java.time.Period.parse(Period.java:349)
at ai.djl.timeseries.transform.feature.Feature.addTimeFeature(Feature.java:129)
at ai.djl.timeseries.transform.feature.Feature.addTimeFeature(Feature.java:75)
at ai.djl.timeseries.transform.feature.AddTimeFeature.transform(AddTimeFeature.java:63)
at ai.djl.timeseries.dataset.TimeSeriesDataset.apply(TimeSeriesDataset.java:105)
at ai.djl.timeseries.dataset.TimeSeriesDataset.get(TimeSeriesDataset.java:60)
at ai.djl.training.dataset.DataIterable.fetch(DataIterable.java:170)
at ai.djl.training.dataset.DataIterable.next(DataIterable.java:145)
at ai.djl.training.dataset.DataIterable.next(DataIterable.java:43)
at ai.djl.training.EasyTrain.fit(EasyTrain.java:54)
```

if we specify the frequency in the format required by the Period and Duration classes (for example "1h", "5h") we will receive an exception from DJL:
```
Exception in thread "main" java.lang.IllegalArgumentException: invalid frequency
at ai.djl.timeseries.timefeature.Lag.getLagsForFreq(Lag.java:90)
at ai.djl.timeseries.timefeature.Lag.getLagsForFreq(Lag.java:118)
at ai.djl.timeseries.model.deepar.DeepARNetwork.(DeepARNetwork.java:127)
at ai.djl.timeseries.model.deepar.DeepARTrainingNetwork.(DeepARTrainingNetwork.java:26)
at ai.djl.timeseries.model.deepar.DeepARNetwork$Builder.buildTrainingNetwork(DeepARNetwork.java:608)
```

if we specify the frequency like "15M" = it will be 15 months, so with weeks and months everything is ok

Contributor guide

Open the contributing guide

Research direction

Start with ai.djl.timeseries.transform.feature.Feature.addTimeFeature and ai.djl.timeseries.timefeature.Lag.getLagsForFreq, using the frequency examples and stack traces in the report. Trace how DeepARNetwork constructs its lag configuration, then inspect the related time-series tests or entry points. Done means the documented frequency forms no longer cause parsing or invalid-frequency exceptions, with regression coverage for the reproduced cases.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
machine-learning
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.