gluonts.mx.model.estimator module#
- class gluonts.mx.model.estimator.GluonEstimator(*, trainer: ~gluonts.mx.trainer._base.Trainer, batch_size: int = 32, lead_time: int = 0, dtype: ~typing.Type = <class 'numpy.float32'>)[source]#
Bases:
Estimator
An Estimator type with utilities for creating Gluon-based models.
To extend this class, one needs to implement three methods: create_transformation, create_training_network, create_predictor, create_training_data_loader, and create_validation_data_loader.
- create_predictor(transformation: Transformation, trained_network: HybridBlock) Predictor [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: 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() HybridBlock [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() 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: 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
- classmethod from_hyperparameters(**hyperparameters) GluonEstimator [source]#
- train(training_data: Dataset, validation_data: Optional[Dataset] = None, shuffle_buffer_length: Optional[int] = None, cache_data: bool = False, **kwargs) Predictor [source]#
Train the estimator on the given data.
- Parameters:
training_data – Dataset to train the model on.
validation_data – Dataset to validate the model on during training.
- Returns:
The predictor containing the trained model.
- Return type:
- train_from(predictor: GluonPredictor, training_data: Dataset, validation_data: Optional[Dataset] = None, shuffle_buffer_length: Optional[int] = None, cache_data: bool = False) Predictor [source]#
- train_model(training_data: Dataset, validation_data: Optional[Dataset] = None, from_predictor: Optional[GluonPredictor] = None, shuffle_buffer_length: Optional[int] = None, cache_data: bool = False) TrainOutput [source]#