diff --git a/src/gluonts/dataset/pandas.py b/src/gluonts/dataset/pandas.py index 32fc72bc6b..61202022ba 100644 --- a/src/gluonts/dataset/pandas.py +++ b/src/gluonts/dataset/pandas.py @@ -15,7 +15,7 @@ import logging from dataclasses import dataclass, field, InitVar -from typing import Any, Iterable, Optional, Type, Union +from typing import Any, Iterable, Optional, Type, Union, cast import numpy as np import pandas as pd @@ -350,5 +350,5 @@ def is_uniform(index: pd.PeriodIndex) -> bool: >>> is_uniform(pd.DatetimeIndex(ts).to_period("2H")) False """ - other = pd.period_range(index[0], periods=len(index), freq=index.freq) - return (other == index).all() + + return cast(bool, np.all(np.diff(index.asi8) == index.freq.n)) diff --git a/src/gluonts/torch/model/d_linear/lightning_module.py b/src/gluonts/torch/model/d_linear/lightning_module.py index e6b4fac39f..28dccf1b97 100644 --- a/src/gluonts/torch/model/d_linear/lightning_module.py +++ b/src/gluonts/torch/model/d_linear/lightning_module.py @@ -30,15 +30,14 @@ class DLinearLightningModule(pl.LightningModule): Parameters ---------- - model - ``DLinearModel`` to be trained. + model_kwargs + Keyword arguments to construct the ``DLinearModel`` to be trained. loss - Loss function to be used for training, - default: ``NegativeLogLikelihood()``. + Loss function to be used for training. lr - Learning rate, default: ``1e-3``. + Learning rate. weight_decay - Weight decay regularization parameter, default: ``1e-8``. + Weight decay regularization parameter. """ @validated() diff --git a/src/gluonts/torch/model/deepar/estimator.py b/src/gluonts/torch/model/deepar/estimator.py index c916cedce0..3e16605f6f 100644 --- a/src/gluonts/torch/model/deepar/estimator.py +++ b/src/gluonts/torch/model/deepar/estimator.py @@ -166,7 +166,7 @@ def __init__( distr_output: DistributionOutput = StudentTOutput(), loss: DistributionLoss = NegativeLogLikelihood(), scaling: bool = True, - default_scale: float = 0.0, + default_scale: Optional[float] = None, lags_seq: Optional[List[int]] = None, time_features: Optional[List[TimeFeature]] = None, num_parallel_samples: int = 100, diff --git a/src/gluonts/torch/model/deepar/lightning_module.py b/src/gluonts/torch/model/deepar/lightning_module.py index 3f470f3a48..fc676dfab3 100644 --- a/src/gluonts/torch/model/deepar/lightning_module.py +++ b/src/gluonts/torch/model/deepar/lightning_module.py @@ -33,17 +33,16 @@ class DeepARLightningModule(pl.LightningModule): Parameters ---------- - model - ``DeepARModel`` to be trained. + model_kwargs + Keyword arguments to construct the ``DeepARModel`` to be trained. loss - Loss function to be used for training, - default: ``NegativeLogLikelihood()``. + Loss function to be used for training. lr - Learning rate, default: ``1e-3``. + Learning rate. weight_decay - Weight decay regularization parameter, default: ``1e-8``. + Weight decay regularization parameter. patience - Patience parameter for learning rate scheduler, default: ``10``. + Patience parameter for learning rate scheduler. """ @validated() diff --git a/src/gluonts/torch/model/deepar/module.py b/src/gluonts/torch/model/deepar/module.py index b220d603b0..5f073bc914 100644 --- a/src/gluonts/torch/model/deepar/module.py +++ b/src/gluonts/torch/model/deepar/module.py @@ -105,7 +105,7 @@ def __init__( distr_output: DistributionOutput = StudentTOutput(), lags_seq: Optional[List[int]] = None, scaling: bool = True, - default_scale: float = 0.0, + default_scale: Optional[float] = None, num_parallel_samples: int = 100, ) -> None: super().__init__() diff --git a/src/gluonts/torch/model/lag_tst/lightning_module.py b/src/gluonts/torch/model/lag_tst/lightning_module.py index 4f644c1cc3..2510944cfa 100644 --- a/src/gluonts/torch/model/lag_tst/lightning_module.py +++ b/src/gluonts/torch/model/lag_tst/lightning_module.py @@ -30,15 +30,14 @@ class LagTSTLightningModule(pl.LightningModule): Parameters ---------- - model - ``LagTSTModel`` to be trained. + model_kwargs + Keyword arguments to construct the ``LagTSTModel`` to be trained. loss - Loss function to be used for training, - default: ``NegativeLogLikelihood()``. + Loss function to be used for training. lr - Learning rate, default: ``1e-3``. + Learning rate. weight_decay - Weight decay regularization parameter, default: ``1e-8``. + Weight decay regularization parameter. """ @validated() diff --git a/src/gluonts/torch/model/mqf2/lightning_module.py b/src/gluonts/torch/model/mqf2/lightning_module.py index 7a2ddfe98b..6dc824beb4 100644 --- a/src/gluonts/torch/model/mqf2/lightning_module.py +++ b/src/gluonts/torch/model/mqf2/lightning_module.py @@ -35,14 +35,14 @@ class MQF2MultiHorizonLightningModule(pl.LightningModule): Parameters ---------- - model - An MQF2MultiHorizonModel instance + model_kwargs + Keyword arguments to construct the ``MQF2MultiHorizonModel`` to be trained. loss - Distribution loss + Distribution loss. lr - Learning rate + Learning rate. weight_decay - Weight decay during training + Weight decay during training. patience Patience parameter for learning rate scheduler, default: ``10``. """ diff --git a/src/gluonts/torch/model/patch_tst/lightning_module.py b/src/gluonts/torch/model/patch_tst/lightning_module.py index e2ab746f9e..f5e95158b2 100644 --- a/src/gluonts/torch/model/patch_tst/lightning_module.py +++ b/src/gluonts/torch/model/patch_tst/lightning_module.py @@ -30,15 +30,14 @@ class PatchTSTLightningModule(pl.LightningModule): Parameters ---------- - model - ``PatchTSTModel`` to be trained. + model_kwargs + Keyword arguments to construct the ``PatchTSTModel`` to be trained. loss - Loss function to be used for training, - default: ``NegativeLogLikelihood()``. + Loss function to be used for training. lr - Learning rate, default: ``1e-3``. + Learning rate. weight_decay - Weight decay regularization parameter, default: ``1e-8``. + Weight decay regularization parameter. """ @validated() diff --git a/src/gluonts/torch/model/simple_feedforward/lightning_module.py b/src/gluonts/torch/model/simple_feedforward/lightning_module.py index dc3c28720d..b7cf9a529a 100644 --- a/src/gluonts/torch/model/simple_feedforward/lightning_module.py +++ b/src/gluonts/torch/model/simple_feedforward/lightning_module.py @@ -30,15 +30,14 @@ class SimpleFeedForwardLightningModule(pl.LightningModule): Parameters ---------- - model - ``SimpleFeedForwardModel`` to be trained. + model_kwargs + Keyword arguments to construct the ``SimpleFeedForwardModel`` to be trained. loss - Loss function to be used for training, - default: ``NegativeLogLikelihood()``. + Loss function to be used for training. lr - Learning rate, default: ``1e-3``. + Learning rate. weight_decay - Weight decay regularization parameter, default: ``1e-8``. + Weight decay regularization parameter. """ @validated() diff --git a/src/gluonts/torch/model/tft/lightning_module.py b/src/gluonts/torch/model/tft/lightning_module.py index 2d11ebd890..f6f7daa335 100644 --- a/src/gluonts/torch/model/tft/lightning_module.py +++ b/src/gluonts/torch/model/tft/lightning_module.py @@ -31,14 +31,14 @@ class TemporalFusionTransformerLightningModule(pl.LightningModule): Parameters ---------- - model - ``TemporalFusionTransformerModel`` to be trained. + model_kwargs + Keyword arguments to construct the ``TemporalFusionTransformerModel`` to be trained. lr - Learning rate, default: ``1e-3``. + Learning rate. weight_decay - Weight decay regularization parameter, default: ``1e-8``. + Weight decay regularization parameter. patience - Patience parameter for learning rate scheduler, default: ``10``. + Patience parameter for learning rate scheduler. """ @validated()