MCPcopy Create free account
hub / github.com/Open-Quant/openquant / _build_intervals

Function _build_intervals

python/openquant/feature_diagnostics.py:62–75  ·  view source on GitHub ↗
(event_end_indices: Sequence[int] | None, n_rows: int)

Source from the content-addressed store, hash-verified

60
61
62def _build_intervals(
63 event_end_indices: Sequence[int] | None,
64 n_rows: int,
65 allow_unpurged: bool = False,
66) -> list[tuple[int, int]]:
67 if event_end_indices is None:
68 if not allow_unpurged:
69 raise ValueError(
70 "event_end_indices is required for purged cross-validation. Without "
71 "label end indices every sample becomes a degenerate one-row interval "
72 "(i, i), which can only overlap the test rows themselves, so the purge "
73 "step removes nothing and training folds leak label information from "
74 "the test fold. Pass event_end_indices (the row index at which each "
75 "sample's label is resolved), or pass allow_unpurged=True to accept "
76 "embargo-only splits explicitly."
77 )
78 return [(i, i) for i in range(n_rows)]

Callers 3

mda_importanceFunction · 0.85
sfi_importanceFunction · 0.85

Calls 1

appendMethod · 0.80

Tested by

no test coverage detected