Time Series Forecasting ExperimentsΒΆ
In this notebook we will show how to run a simple time series forecasting experiment using the tsml-eval
package. Time series forecasting is the task of predicting future values of a time series.
[ ]:
# import numpy as np
# from aeon.datasets import load_airline
# from aeon.forecasting.model_selection import temporal_train_test_split
#
# from tsml_eval.evaluation.storage import load_forecaster_results
# from tsml_eval.experiments import (
# experiments,
# get_forecaster_by_name,
# run_forecasting_experiment,
# )
[ ]:
# y = load_airline()
# train, test = temporal_train_test_split(y)
[ ]:
# # set_regressor can be used to find various regressors by string, but
# # any aeon, tsml or sklearn regressor can be used in the experiments function
# forecaster = get_forecaster_by_name("NaiveForecaster")
#
# # record memory usage every 0.1 seconds, just here for notebook speed
# # does not need to be changed for usage
# experiments.MEMRECORD_INTERVAL = 0.1
#
# run_forecasting_experiment(
# np.array(train),
# np.array(test),
# forecaster,
# "./generated_results/",
# dataset_name="Airline",
# random_seed=0,
# )
A function is also available to load the dataset as well as run an experiment, see load_and_run_forecasting_experiment
in tsml_eval.experiments
.
Both experiment functions will output a results file in the {results_dir}/{forecaster_name}/Predictions/{dataset_name}/
directory. These files can be loaded individually, or used as a collection in the evaluation
module. See the evaluation notebook for more details.
[ ]:
# fr = load_forecaster_results(
# "./generated_results/NaiveForecaster/Predictions/Airline/testResample0.csv"
# )
# print(fr.predictions)
# print(fr.mean_absolute_percentage_error)
Generated using nbsphinx. The Jupyter notebook can be found here.