(event_end_indices: Sequence[int] | None, n_rows: int)
| 60 | |
| 61 | |
| 62 | def _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)] |
no test coverage detected