gluonts.torch.model.deepar package

class gluonts.torch.model.deepar.DeepARModel(freq: str, context_length: int, prediction_length: int, num_feat_dynamic_real: int, num_feat_static_real: int, num_feat_static_cat: int, cardinality: List[int], embedding_dimension: Optional[List[int]] = None, num_layers: int = 2, hidden_size: int = 40, dropout_rate: float = 0.1, distr_output: gluonts.torch.modules.distribution_output.DistributionOutput = gluonts.torch.modules.distribution_output.StudentTOutput(), lags_seq: Optional[List[int]] = None, scaling: bool = True, num_parallel_samples: int = 100)[source]

Bases: torch.nn.modules.module.Module

forward(feat_static_cat: torch.Tensor, feat_static_real: torch.Tensor, past_time_feat: torch.Tensor, past_target: torch.Tensor, past_observed_values: torch.Tensor, future_time_feat: torch.Tensor, num_parallel_samples: Optional[int] = None) → torch.Tensor[source]

Defines the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

output_distribution(params, scale=None, trailing_n=None) → torch.distributions.distribution.Distribution[source]
training = None
unroll_lagged_rnn(feat_static_cat: torch.Tensor, feat_static_real: torch.Tensor, past_time_feat: torch.Tensor, past_target: torch.Tensor, past_observed_values: torch.Tensor, future_time_feat: Optional[torch.Tensor] = None, future_target: Optional[torch.Tensor] = None) → Tuple[Tuple[torch.Tensor, ...], torch.Tensor, Tuple[torch.Tensor, torch.Tensor]][source]
class gluonts.torch.model.deepar.DeepARLightningModule(model: gluonts.torch.model.deepar.module.DeepARModel, loss: gluonts.torch.modules.loss.DistributionLoss = NegativeLogLikelihood(), lr: float = 0.001, weight_decay: float = 1e-08)[source]

Bases: pytorch_lightning.core.lightning.LightningModule

configure_optimizers()[source]

Returns the optimizer to use

training = None
training_step(batch, batch_idx: int)[source]

Execute training step

validation_step(batch, batch_idx: int)[source]

Execute validation step

class gluonts.torch.model.deepar.DeepAREstimator(freq: str, prediction_length: int, context_length: Optional[int] = None, num_layers: int = 2, hidden_size: int = 40, dropout_rate: float = 0.1, num_feat_dynamic_real: int = 0, num_feat_static_cat: int = 0, num_feat_static_real: int = 0, cardinality: Optional[List[int]] = None, embedding_dimension: Optional[List[int]] = None, distr_output: gluonts.torch.modules.distribution_output.DistributionOutput = gluonts.torch.modules.distribution_output.StudentTOutput(), loss: gluonts.torch.modules.loss.DistributionLoss = NegativeLogLikelihood(), scaling: bool = True, lags_seq: Optional[List[int]] = None, time_features: Optional[List[gluonts.time_feature._base.TimeFeature]] = None, num_parallel_samples: int = 100, batch_size: int = 32, num_batches_per_epoch: int = 50, trainer_kwargs: Optional[Dict[str, Any]] = {})[source]

Bases: gluonts.torch.model.estimator.PyTorchLightningEstimator

create_lightning_module() → gluonts.torch.model.deepar.lightning_module.DeepARLightningModule[source]

Create and return the network used for training (i.e., computing the loss).

Returns

The network that computes the loss given input data.

Return type

nn.Module

create_predictor(transformation: gluonts.transform._base.Transformation, module: gluonts.torch.model.deepar.lightning_module.DeepARLightningModule) → gluonts.torch.model.predictor.PyTorchPredictor[source]

Create and return a predictor object.

Returns

A predictor wrapping a nn.Module used for inference.

Return type

Predictor

create_training_data_loader(data: gluonts.dataset.common.Dataset, module: gluonts.torch.model.deepar.lightning_module.DeepARLightningModule, shuffle_buffer_length: Optional[int] = None, **kwargs) → Iterable[source]
create_transformation() → gluonts.transform._base.Transformation[source]

Create and return the transformation needed for training and inference.

Returns

The transformation that will be applied entry-wise to datasets, at training and inference time.

Return type

Transformation

create_validation_data_loader(data: gluonts.dataset.common.Dataset, module: gluonts.torch.model.deepar.lightning_module.DeepARLightningModule, **kwargs) → Iterable[source]
freq = None
lead_time = None
prediction_length = None

Submodules