## forecast.run_cross_validation()


Run rolling forecast origin cross-validation.


Usage

``` python
forecast.run_cross_validation(
    forecast_function,
    historic,
    params,
    horizon,
    step,
    min_train=365 * 2,
    cores=1,
    error_horizons=(7, 14, 21, 28, 35, 42)
)
```


This can take some time because it fits a separate forecasting model for every combination of fold, metric, and area. Progress is displayed with `tqdm`, including the number of completed forecasts. The function also prints the number of worker processes used and the total run time.


## Parameters


`forecast_function: prophet | arima`  
Forecasting function to run.

`historic: pd.DataFrame`  
Historic data used to create rolling training and test samples.

`params: ProphetParams | ARIMAParams`  
Parameters for the selected forecasting model.

`horizon: int`  
Number of daily observations in each test set.

`step: int`  
How many days to move by before creating a new sample. Warning: using a step of 365 will produce test samples all at approximately the same time of year.

`min_train: int = 365 * 2`  
Minimum number of days to include in training sample. By default, set to 2 years as that allows detection of yearly seasonality.

`cores: int = ``1`  
Number of CPU cores to use. Set to 1 for sequential processing or -1 to use all available cores.

`error_horizons=(7, 14, 21, 28, 35, 42)`  
Horizons to calculate error at.


## Returns


`forecasts: pd.DataFrame`  
Forecasts contains results for every fold, metric, and area.
