Purging labels with interval overlap
Question
Using closed timestamp intervals, implement a mask selecting training labels that do not overlap any validation label interval. What is the boundary convention?
Short answer
Two closed intervals overlap when each starts no later than the other's end. A shared endpoint therefore counts as overlap. The implementation is quadratic and suitable as a clear reference; large datasets may need interval indexing.
Original question and answer written by SelfMadeQuant.com.
See the hint and the full worked solution in the question bank (free account).
Open the worked solutionLessons behind this question
Start with a free lesson: Basic Statistics and Regression is part of a free topic. Create a free account, no card needed, to read it in full with worked solutions.
Read it free