quantlab.model.split.Fold#

class quantlab.model.split.Fold(index, train_window, fitted_train_window, test_window)[source]#

Bases: object

One walk-forward fold; every window is (start, end), both ends inclusive.

Dates are np.datetime_as_string values of the axis’ bars.

Attributes:
indexint

The fold’s position in the walk, from 0. A skipped fold leaves its index unused.

train_windowtuple[str, str]

The training window before the purge: what a model is configured with.

fitted_train_windowtuple[str, str]

The training window after the purge: the bars actually fitted.

test_windowtuple[str, str]

The test window.

Examples

>>> Fold(0, ("2024-01-01", "2024-01-10"), ("2024-01-01", "2024-01-08"),
...      ("2024-01-11", "2024-01-15")).fitted_train_window
('2024-01-01', '2024-01-08')