djl
djl copied to clipboard
TimeSeries API Bugs (frequency, context length, FEAT_DYNAMIC_REAL)
trafficstars
If we specify the frequency as required by the Lag class or as the GluonTS documentation says,
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.<init>(DeepARNetwork.java:127)
at ai.djl.timeseries.model.deepar.DeepARTrainingNetwork.<init>(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