P3-5.6 Overlapping Input Windows and Sample Counts¶
Section ID:
P3-5.6Version:v2026.09.19
Subtitle: Why can sample counts look larger than reality when the same event is cut into multiple windows?
Once the input window has been fixed, we can create several windows from the same source time series. At that point, one problem is often missed. It becomes easy to read there are more windows, so there must also be more samples. But when many windows overlap, this often means we are cutting the same event several times, not that the number of independent events has increased by the same amount.
The number of input windows and the number of source events may not be the same.
| Distinction | Meaning |
|---|---|
| Number of source events | The number of actual full actions or actual events |
| Number of input windows | The number of learning-input pieces cut from those events |
For example, if we cut one action into windows of length 30 with stride 10, one event can expand into several inputs.
stride is the number of measurement points by which the window start moves. With source length 100, window length 30, and stride 10, the starts are 0, 10, …, 70: eight windows. If incomplete windows at the end are discarded, window count = floor((source length−window length)/stride)+1; if the source is shorter than the window, the count is zero. Here, floor means rounding down to the integer below.
| event_id | Source length | Window length | stride | Number of windows created |
|---|---|---|---|---|
| A | 100 | 30 | 10 | 8 |
| B | 100 | 30 | 10 | 8 |
If we look at this table and say only there are 16 samples, that is only half correct. The real number of events is 2, while the number of input windows is 16. So in a comparison report or a judgment about representativeness, the fact that there were still only 2 events should be written together.
The more overlapping windows there are, the more easily the following problems appear.
| Problem that appears | Why caution is needed |
|---|---|
| The sample count looks larger | The evidence can look exaggerated compared with the actual number of events |
| Similar windows repeat | The pattern of one event can appear several times, weakening independence |
| Longer or more densely sliced events create more windows | The influence of a specific event can become too large in the table |
At this stage, we do not need to cover complicated evaluation design. Still, it is safer to leave behind the following notes.
| Note to write down first | Why it is needed |
|---|---|
| Number of source events | So the actual evidence unit does not get hidden |
| Number of input windows | So model-input scale can be viewed separately |
| Window length and stride | So the rule by which the windows grew can be explained again |
The Same Observation Enters Two Windows¶
Suppose a small fictional event A contains [10, 11, 12, 13, 14, 15] in observation order. These numbers are measured values; their positions run from 0 to 5. Use window length 4 and stride 2, discarding incomplete windows. The notation [start, end) includes the start position and excludes the end position.
| source_event_id | window_id | Position range | Values in the window |
|---|---|---|---|
| A | A-01 | [0, 4) | [10, 11, 12, 13] |
| A | A-02 | [2, 6) | [12, 13, 14, 15] |
The 12 and 13 in both windows are the same observations at positions 2 and 3, not merely coincidentally equal values. The windows contain eight value slots in total, but only six distinct raw observations and one source event. With stride 1, starts 0, 1, and 2 produce three windows; no new event or measurement has been collected.
Likewise, the first two windows for source length 100, window length 30, and stride 10 are [0, 30) and [10, 40). They share 20 observations at positions 10–29. Length and stride here are measured in observation points. Converting them to seconds requires the measurement interval.
Keep source_event_id, window_id, window_start, and window_end for derived windows, together with the window length, stride, and incomplete-window rule. Count rows in the source table after checking that each event has one row; count distinct source_event_id values in a window table. The example below counts events directly, so it needs no separate event-weight column.
Problem situation: check what illusion appears if the number of windows and the number of source events are read as the same number when many input windows overlap.
Input: the source-event table p3_5_6_source_events.csv and the movement interval to test, stride_to_try. Each row in this table is one source event, with an event length (length) and window length (window).
Expected output: output showing how many windows each event expands into and how much larger the window count becomes than the source_event count. If stride_to_try changes, the window count and expansion ratio also change.
Concept to check: the number of input windows is only the number of derived pieces and should not be read in the same unit as the number of source events
Expected output:
The Denominator of 6.58 Is 36 Source Events¶
The default output means 237 windows ÷ 36 events ≈ 6.58 windows/event: the average number of windows per event. It does not mean 6.58 times as much new information or 237 independent events. If a short event produces no windows, the denominator here still counts all events in the input source table; distinguish this from counting only events that produce at least one window.
| Stride: observation points | Input source events | Windows | Average windows/event |
|---|---|---|---|
| 5 | 36 | 453 | 12.58 |
| 10 | 36 | 237 | 6.58 |
| 20 | 36 | 129 | 3.58 |
Before running the code, predict what changes when stride becomes 20, then compare the output with the table. The answer is 129 windows and about 3.58 windows/event, with the same 36 events. For E01 alone, starts 0, 20, 40, and 60 produce four windows. The rule does not append an extra window starting at 70.
In the grouped output, L2 recent and L3 baseline each have six events, but contribute 43 and 34 windows. Giving each window equal importance makes their contributions 43:34; comparing events equally gives 6:6. Choose the unit of equal contribution to match the question. The name recent does not itself create extra windows; source lengths and window settings create the count difference in this data.
Different Event IDs Do Not Establish Independence¶
Thirty-six distinct event IDs do not guarantee 36 independent experiments. Consecutive events from the same machine, day, or work batch may share influences. Nor does this make overlapping windows useless: they can expose different positions within an event as inputs. That remains different from collecting new events.
When assessing performance on new events, putting A-01 in training and A-02 in evaluation puts the same raw observations on both sides. Splitting by source event is one way to prevent this overlap. Evaluation on new machines or future periods also requires checking broader groups or time order. This is why derived windows retain their source event IDs.
Separating Window Counts from Source-Event Counts¶
The core of this section is to separate the window count grew from the number of source events increased. If many overlapping windows are created from the same two events, the number of input pieces grows, but the event count itself stays the same.
flowchart TD
E[Two source events]
W[Many overlapping windows]
C[Window count grows]
N[Event count stays the same]
E --> W
W --> C
E --> N
Checklist¶
- Can you interpret 237 windows, 36 events, and 6.58 windows/event as different units?
- Can you identify shared observation positions and verify 129 windows at stride 20?
-
Can you explain why the source-event count does not guarantee statistical independence?
-
Did you calculate the window count from the input length and stride?
- Can you explain why overlapping window counts differ from independent event counts?
Sources and Further Reading¶
- Google for Developers,
Machine Learning Glossary,example,labeled example. An example may lack a label; a labeled example includes features and a label. Counting overlapping windows separately from source events is the distinction demonstrated by this section’s case. Machine Learning Glossary / Accessed: 2026-09-15 - W3C,
PROV-Overview. Because the provenance framework says we should be able to trace which derivation created which entity, it provides the higher-level frame that each input window should remain separated by which source event it came from, so that window count and event count do not get confused. https://www.w3.org/TR/prov-overview/ / Accessed: 2026-07-20 - Google for Developers,
Datasets: Dividing the original dataset. Because it provides the general perspective that training examples should be distinguished from the source data and the rules that created them, it helps generalize the explanation in this section that even when many windows overlap, source-event units and input-piece units should still be written separately. https://developers.google.com/machine-learning/crash-course/overfitting/dividing-datasets / Accessed: 2026-07-20 - scikit-learn developers,
Cross-validation: evaluating estimator performance. Because it explains that dependent samples from the same source process can break the independent-and-identically-distributed assumption, and that grouped data should avoid placing samples from the same group in both training and validation folds, it reinforces this section's caution that overlapping input windows may be dependent pieces derived from the same event rather than new real events. https://scikit-learn.org/stable/modules/cross_validation.html#cross-validation-iterators-for-grouped-data / Accessed: 2026-09-19