Table Of Contents
Table Of Contents

gluonts.evaluation.backtest module

class gluonts.evaluation.backtest.BacktestInformation(train_dataset_stats, test_dataset_stats, estimator, agg_metrics)[source]

Bases: tuple

agg_metrics

Alias for field number 3

estimator

Alias for field number 2

static make_from_log(log_file)[source]
static make_from_log_contents(log_contents)[source]
test_dataset_stats

Alias for field number 1

train_dataset_stats

Alias for field number 0

gluonts.evaluation.backtest.backtest_metrics(train_dataset: Optional[gluonts.dataset.common.Dataset], test_dataset: gluonts.dataset.common.Dataset, forecaster: Union[gluonts.model.estimator.Estimator, gluonts.model.predictor.Predictor], evaluator=<gluonts.evaluation._base.Evaluator object>, num_eval_samples: int = 100, logging_file: Optional[str] = None, use_symbol_block_predictor: bool = False)[source]
Parameters:
  • train_dataset – Dataset to use for training.
  • test_dataset – Dataset to use for testing.
  • forecaster – An estimator or a predictor to use for generating predictions.
  • evaluator – Evaluator to use.
  • num_eval_samples – Number of samples to use when generating sample-based forecasts.
  • logging_file – If specified, information of the backtest is redirected to this file.
  • use_symbol_block_predictor – Use a SymbolBlockPredictor during testing.
Returns:

A tuple of aggregate metrics and per-time-series metrics obtained by training forecaster on train_dataset and evaluating the resulting evaluator provided on the test_dataset.

Return type:

tuple

gluonts.evaluation.backtest.make_evaluation_predictions(dataset: gluonts.dataset.common.Dataset, predictor: gluonts.model.predictor.Predictor, num_eval_samples: int) → Tuple[Iterator[gluonts.model.forecast.Forecast], Iterator[pandas.core.series.Series]][source]

Return predictions on the last portion of predict_length time units of the target. Such portion is cut before making predictions, such a function can be used in evaluations where accuracy is evaluated on the last portion of the target.

Parameters:
  • dataset – Dataset where the evaluation will happen. Only the portion excluding the prediction_length portion is used when making prediction.
  • predictor – Model used to draw predictions.
  • num_eval_samples – Number of samples to draw on the model when evaluating.
gluonts.evaluation.backtest.serialize_message(logger, message: str, variable)[source]