## 4 WFDB Window-Based Evaluation
### Discrepancies in the Selection of Window Size  
The benchmark window size used for R-peak validation is 150 ms, as matching with the exact location of the R-peak defined by the cardiologist is not essential as long as the predicted sample falls within the QRS or, more precisely, the start and end of the R-wave [88]. The QRS complex represents ventricular depolarization, and the R-peak is the highest standard point in ECG. Given the variability in the signal and adopted methodologies, slight differences in timing are expected. So, a window of 150 ms is benchmarked by ANSI/AAMI to cover the entire R-wave to ensure the accuracy of predicted R-peak validation without compromising the overall clinical interpretation. This 150 ms window defines the maximum absolute difference in annotations that can be considered a match. Suppose a predicted and a reference annotation coincide within this span. In that case, the predicted beat is classified as a legitimate peak, similar to those defined by medical experts [30; 81; 86; 89]. AAMI defines this standard to maintain consistent testing protocols across the numerous methodologies proposed for R-peak detection. Reviewing the literature, we found manuscripts that employ different window sizes or the same window size of 150 ms without providing a reason for deviation from the standard. These manuscripts can be categorized as follows:  
* [PERSON] et al. [28] and [PERSON] et al. [33] mentioned window sizes of 50 ms and 80 ms, respectively. [PERSON] et al. [90] and [PERSON] et al. [34] both mentioned a window size of 100 ms, smaller than the defined AAMI benchmark.
* [PERSON] et al. [29] and [PERSON] et al. [44] mentioned a window size of 150 ms.
* [PERSON] et al. [30] and [PERSON] et al. [91] reported a window size of 300 ms, but they did not specify whether this refers to a fixed window size of 0.30 s, a user-defined parametric value for comparing predicted results to reference annotations, or simply the total of \(\pm 150\) ms tolerance (\(+150\) ms and \(-150\) ms) which is a benchmark window size of 0.15 s. If they set the value of 0.30 s for comparison, this would represent a significant deviation from the AAMI benchmark for comparing R-peak detection results as the total becomes 600 ms. Similarly, [PERSON] et al. also reported a time window of 320 ms [92] with similar ambiguity in their reporting.  
These variations in comparable window size can lead to inconsistent evaluations and misinterpretations of the detector's effectiveness. To understand this, consider the case in Figure 4a, from record 108 of the MIT-BIH database; suppose the R-peak detector picks a non-peak and classifies it as an FP using the standard AAMI benchmark of a 150 ms window. However, increasing the window size can transform this non-peak into a TP, as shown in Figure 4a. Similarly, consider the case of record 203, as shown in Figure 4b. The peaks in this record have obscured amplitudes, leading to more missed beats or FNs. Suppose a non-peak is incorrectly picked by the detector initially, increasing the FP count during validation. However, if the window size is widened to 300 ms for retesting, the same FP would be reclassified as a TP, reducing the final FP and FN counts. These cases from the MIT-BIH database illustrate how variations in window size can significantly impact the statistical outcomes. [PERSON] et al. [93] criticized the literature for using large window sizes up to 320 ms, which exceed the maximum allowable tolerance of 150 ms. They emphasized the need for greater transparency and adherence to standardized evaluation protocols in ECG R-peak validation.