quantlab.model.evaluation.Segments#

class quantlab.model.evaluation.Segments(train, val, test)[source]#

Bases: object

The bars of a unit’s train, validation and test segments.

Each field is an array of timestamps, empty when the unit has no such segment; a model’s come from its purged split of the training window and its test dates.

Examples

>>> segments = Segments(train=stamps[:20], val=stamps[:0], test=stamps[25:])
>>> [split for split, _ in segments.splits()]
['train', 'test']
splits()[source]#

Return (split, timestamps) for each non-empty segment, in SPLITS order.

Examples

>>> Segments(train=stamps[:2], val=stamps[:0], test=stamps[2:3]).splits()[1][0]
'test'