splits.train_test_split()

Create a single train/test split.

Usage

Source

splits.train_test_split(
    data,
    horizon,
    min_train=365 * 2,
    test_end=None,
)

Parameters

data: pd.DataFrame

Data containing a ds column.

horizon: int

Number of daily observations in the test set.

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.

test_end: pd.Timestamp | None = None
Final date in the test set. If None, uses the latest date in the data.

Returns

train, test : tuple[pd.DataFrame, pd.DataFrame]
Training and test data.