quantlab.runs.run_metrics.slice_ranges#
- quantlab.runs.run_metrics.slice_ranges(split)[source]#
Return the ranges of the
in_sampleandout_of_sampleslices of a split.in_samplecomes fromsplit["in_sample_ranges"]when present (a stitchedrun_cv()account) and from the singlesplit["in_sample_range"]otherwise;out_of_samplefromsplit["out_of_sample_ranges"]. A slice without a bar has no range. A split withoutout_of_sample_ranges(Noneor empty: a run of given weights, which has no training window) has no slices.- Parameters:
- splitMapping or None
The split keys of a run, as
metrics.jsonrecords them.
- Returns:
- dict
{"in_sample": ranges, "out_of_sample": ranges}, or{}.
Examples
>>> slice_ranges({"training_window": ("2024-01-01", "2024-03-29"), ... "in_sample_range": None, ... "out_of_sample_ranges": [("2024-04-01", "2024-06-28")]}) {'in_sample': [], 'out_of_sample': [('2024-04-01', '2024-06-28')]} >>> slice_ranges(None) {}