## splits.rolling_forecast_origin()


Create rolling forecast origin train/test samples.


Usage

``` python
splits.rolling_forecast_origin(
    data,
    horizon,
    step,
    min_train=365 * 2,
)
```


Samples are generated from the most recent data backwards. The test period moves back by `step` days for each fold.


## Parameters


`data: pd.DataFrame`  
Data containing a `ds` column.

`horizon: int`  
Number of daily observations in the 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.


## Returns


`train, test : tuple[list[pd.DataFrame],list[pd.DataFrame]]`  
Training and test dataframes for each fold, ordered from most recent to oldest.
