gluonts.model package#
- class gluonts.model.Estimator(lead_time: int = 0, **kwargs)[source]#
Bases:
object
An abstract class representing a trainable model.
The underlying model is trained by calling the train method with a training Dataset, producing a Predictor object.
- lead_time: int#
- prediction_length: int#
- train(training_data: gluonts.dataset.Dataset, validation_data: Optional[gluonts.dataset.Dataset] = None) gluonts.model.predictor.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
- class gluonts.model.Forecast[source]#
Bases:
object
A abstract class representing predictions.
- as_json_dict(config: gluonts.model.forecast.Config) dict [source]#
- copy_aggregate(agg_fun: Callable)[source]#
Returns a new Forecast object with a time series aggregated over the dimension axis.
- Parameters
agg_fun – Aggregation function that defines the aggregation operation (typically mean or sum).
- copy_dim(dim: int)[source]#
Returns a new Forecast object with only the selected sub-dimension.
- Parameters
dim – The returned forecast object will only represent this dimension.
- property freq#
- property index: pandas.core.indexes.period.PeriodIndex#
- info: Optional[Dict]#
- item_id: Optional[str]#
- mean: numpy.ndarray#
- property median: numpy.ndarray#
- plot(prediction_intervals=(50.0, 90.0), show_mean=False, color='b', label=None, output_file=None, *args, **kwargs)[source]#
Plots the median of the forecast as well as prediction interval bounds (requires matplotlib and pandas).
- Parameters
prediction_intervals (float or list of floats in [0, 100]) – Prediction interval size(s). If a list, it will stack the error plots for each prediction interval. Only relevant for error styles with “ci” in the name.
show_mean (boolean) – Whether to also show the mean of the forecast.
color (matplotlib color name or dictionary) – The color used for plotting the forecast.
label (string) – A label (prefix) that is used for the forecast
output_file (str or None, default None) – Output path for the plot file. If None, plot is not saved to file.
args – Other arguments are passed to main plot() call
kwargs – Other keyword arguments are passed to main plot() call
- prediction_length: int#
- quantile(q: Union[float, str]) numpy.ndarray [source]#
Computes a quantile from the predicted distribution.
- Parameters
q – Quantile to compute.
- Returns
Value of the quantile across the prediction range.
- Return type
numpy.ndarray
- start_date: pandas._libs.tslibs.period.Period#
- class gluonts.model.IncrementallyTrainable(*args, **kwds)[source]#
Bases:
typing_extensions.Protocol
- train_from(predictor: gluonts.model.predictor.Predictor, training_data: gluonts.dataset.Dataset, validation_data: Optional[gluonts.dataset.Dataset] = None) gluonts.model.predictor.Predictor [source]#
Experimental: this feature may change in future versions. Train the estimator, starting from a previously trained predictor, on the given data.
- Parameters
predictor – A previously trained model, from which to initialize the estimator training.
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
- class gluonts.model.Predictor(prediction_length: int, lead_time: int = 0)[source]#
Bases:
object
Abstract class representing predictor objects. :param prediction_length: Prediction horizon.
- classmethod deserialize(path: pathlib.Path, **kwargs) gluonts.model.predictor.Predictor [source]#
Load a serialized predictor from the given path.
- Parameters
path – Path to the serialized files predictor.
**kwargs – Optional context/device parameter to be used with the predictor. If nothing is passed will use the GPU if available and CPU otherwise.
- predict(dataset: gluonts.dataset.Dataset, **kwargs) Iterator[gluonts.model.forecast.Forecast] [source]#
Compute forecasts for the time series in the provided dataset. This method is not implemented in this abstract class; please use one of the subclasses. :param dataset: The dataset containing the time series to predict.
- Returns
Iterator over the forecasts, in the same order as the dataset iterable was provided.
- Return type
Iterator[Forecast]
Subpackages#
- gluonts.model.canonical package
- gluonts.model.deep_factor package
- gluonts.model.deepar package
- gluonts.model.deepstate package
- gluonts.model.deepvar package
- gluonts.model.deepvar_hierarchical package
- gluonts.model.gp_forecaster package
- gluonts.model.gpvar package
- gluonts.model.lstnet package
- gluonts.model.n_beats package
- gluonts.model.naive_2 package
- gluonts.model.npts package
- gluonts.model.prophet package
- gluonts.model.r_forecast package
- gluonts.model.renewal package
- gluonts.model.rotbaum package
- gluonts.model.san package
- gluonts.model.seasonal_naive package
- gluonts.model.seq2seq package
- gluonts.model.simple_feedforward package
- gluonts.model.tft package
- gluonts.model.tpp package
- gluonts.model.transformer package
- gluonts.model.trivial package
- gluonts.model.wavenet package