gluonts.mx.model.gp_forecaster package#
- class gluonts.mx.model.gp_forecaster.GaussianProcessEstimator(freq: str, prediction_length: int, cardinality: int, 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), context_length: typing.Optional[int] = None, kernel_output: gluonts.mx.kernels._kernel_output.KernelOutput = gluonts.mx.kernels._rbf_kernel.RBFKernelOutput(), params_scaling: bool = True, dtype: typing.Type = <class 'numpy.float64'>, max_iter_jitter: int = 10, jitter_method: str = 'iter', sample_noise: bool = True, time_features: typing.Optional[typing.List[typing.Callable[[pandas.core.indexes.period.PeriodIndex], numpy.ndarray]]] = None, num_parallel_samples: int = 100, batch_size: int = 32)[source]#
Bases:
gluonts.mx.model.estimator.GluonEstimator
GaussianProcessEstimator shows how to build a local time series model using Gaussian Processes (GP).
Each time series has a GP with its own hyper-parameters. For the radial basis function (RBF) Kernel, the learnable hyper-parameters are the amplitude and lengthscale. The periodic kernel has those hyper-parameters with an additional learnable frequency parameter. The RBFKernel is the default, but either kernel can be used by inputting the desired KernelOutput object. The noise sigma in the model is another learnable hyper-parameter for both kernels. These parameters are fit using an Embedding of the integer time series indices (each time series has its set of hyper-parameter that is static in time). The observations are the time series values. In this model, the time features are hour of the day and day of the week.
- Parameters
freq – Time series frequency.
prediction_length (int) – Prediction length.
cardinality – Number of time series.
trainer – Trainer instance to be used for model training (default: Trainer()).
context_length – Training length (default: None, in which case context_length = prediction_length).
kernel_output – KernelOutput instance to determine which kernel subclass to be instantiated (default: RBFKernelOutput()).
params_scaling – Determines whether or not to scale the model parameters (default: True).
float_type – Determines whether to use single or double precision (default: np.float64).
max_iter_jitter – Maximum number of iterations for jitter to iteratively make the matrix positive definite (default: 10).
jitter_method – Iteratively jitter method or use eigenvalue decomposition depending on problem size (default: “iter”).
sample_noise – Boolean to determine whether to add \(\sigma^2I\) to the predictive covariance matrix (default: True).
time_features – Time features to use as inputs of the model (default: None, in which case these are automatically determined based on the frequency).
num_parallel_samples – Number of evaluation samples per time series to increase parallelism during inference. This is a model optimization that does not affect the accuracy (default: 100).
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.model.predictor.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: 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() mxnet.gluon.block.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() 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#