gluonts.mx.model.tft package#
- class gluonts.mx.model.tft.TemporalFusionTransformerEstimator(freq: str, prediction_length: int, context_length: Optional[int] = None, trainer: gluonts.mx.trainer._base.Trainer = gluonts.mx.trainer._base.Trainer(add_default_callbacks=True, callbacks=None, clip_gradient=10.0, ctx=None, epochs=100, hybridize=True, init='xavier', learning_rate=0.001, num_batches_per_epoch=50, weight_decay=1e-08), hidden_dim: int = 32, variable_dim: Optional[int] = None, num_heads: int = 4, quantiles: List[float] = [0.1, 0.5, 0.9], num_instance_per_series: int = 100, dropout_rate: float = 0.1, time_features: List[Callable[[pandas.core.indexes.period.PeriodIndex], numpy.ndarray]] = [], static_cardinalities: Dict[str, int] = {}, dynamic_cardinalities: Dict[str, int] = {}, static_feature_dims: Dict[str, int] = {}, dynamic_feature_dims: Dict[str, int] = {}, past_dynamic_features: List[str] = [], train_sampler: Optional[gluonts.transform.sampler.InstanceSampler] = None, validation_sampler: Optional[gluonts.transform.sampler.InstanceSampler] = None, batch_size: int = 32)[source]#
Bases:
gluonts.mx.model.estimator.GluonEstimator
- Parameters
freq – Frequency of the data to train on and predict.
prediction_length (int) – Length of the prediction horizon.
context_length – Number of previous time series values provided as input to the encoder. (default: None).
trainer – Trainer object to be used (default: Trainer())
hidden_dim – Size of the LSTM & transformer hidden states.
variable_dim – Size of the feature embeddings.
num_heads – Number of attention heads in self-attention layer in the decoder.
quantiles – List of quantiles that the model will learn to predict. Defaults to [0.1, 0.5, 0.9]
num_instances_per_series – Number of samples to generate for each time series when training.
dropout_rate – Dropout regularization parameter (default: 0.1).
time_features – List of time features, from
gluonts.time_feature
, to use as dynamic real features in addition to the provided data (default: None, in which case these are automatically determined based on freq).static_cardinalities – Cardinalities of the categorical static features.
dynamic_cardinalities – Cardinalities of the categorical dynamic features that are known in the future.
static_feature_dims – Sizes of the real-valued static features.
dynamic_dims – Sizes of the real-valued dynamic features that are known in the future.
past_dynamic_features – List of names of the real-valued dynamic features that are only known in the past.
train_sampler – Controls the sampling of windows during training.
validation_sampler – Controls the sampling of windows during validation.
batch_size – The size of the batches to be used training and prediction.
- create_predictor(transformation: gluonts.transform._base.Transformation, trained_network: mxnet.gluon.block.HybridBlock) gluonts.mx.model.predictor.RepresentableBlockPredictor [source]#
Create and return a predictor object.
- Parameters
transformation – Transformation to be applied to data before it goes into the model.
module – A trained HybridBlock object.
- Returns
A predictor wrapping a HybridBlock used for inference.
- Return type
- create_training_data_loader(data: gluonts.dataset.Dataset, **kwargs) Iterable[Dict[str, Any]] [source]#
Create a data loader for training purposes.
- Parameters
data – Dataset from which to create the data loader.
- Returns
The data loader, i.e. and iterable over batches of data.
- Return type
DataLoader
- create_training_network() gluonts.mx.model.tft._network.TemporalFusionTransformerTrainingNetwork [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
HybridBlock
- 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
- create_validation_data_loader(data: gluonts.dataset.Dataset, **kwargs) Iterable[Dict[str, Any]] [source]#
Create a data loader for validation purposes.
- Parameters
data – Dataset from which to create the data loader.
- Returns
The data loader, i.e. and iterable over batches of data.
- Return type
DataLoader
- lead_time: int#
- prediction_length: int#