Training models with backtesting
Building on the previous exercises, you'll now evaluate your models using backtesting. You'll define 4 partitions, each with a 12-hour shift and a 72-hour testing window, and execute the process with the cross_validation() method.
The ts DataFrame and initialized MLForecast object (mlf) are preloaded, so you can focus on setting up and running the backtesting. Let's get started!
This exercise is part of the course
Designing Forecasting Pipelines for Production
Hands-on interactive exercise
Have a go at this exercise by completing this sample code.
# Import a necessary library for interval calibration
from mlforecast.utils import ____
# Parameters
h = ____ # Forecast horizon
step_size = ____ # Step size for cross-validation
partitions = 4 # Number of backtesting windows
n_windows = 3 # Windows for prediction interval calibration
method = "conformal_distribution" # Interval calculation method
levels = [95] # Confidence level
# Initialize PredictionIntervals
pi = ____(h=____, n_windows=____, method=____)