## 3 Background
### Binary Harris Hawks Optimizer (BHHO)
To ensure signal quality, the first and last 5 s of the recordings were excluded, resulting in a 20 s segment for analysis. The dataset contains 197 trials, and all subjects have completed at least three trials. This curated dataset offers an appropriate foundation for the validation of the proposed model. #### 4.1.2 Signal Preprocessing

The preprocessing stage aims to clean the raw PPG signals by removing noise, artifacts, and baseline shifts caused by motion and physiological interference. Examples of raw signals with varying quality are shown in Figure 4. Preprocessing was performed using the NeuroKit2 library [40], employing [PERSON]'s method [41] to enhance signal quality. A third-order Butterworth bandpass filter (0.5-8 Hz) was applied to remove baseline wander and high-frequency noise. This filter was chosen for its maximally flat response, which preserves essential features such as systolic peaks while minimizing distortion. The bandpass Butterworth filter is mathematically represented in Equation (16) [42],

\[H(s)=\frac{\omega_{c}^{2n}}{s^{2n}+\sqrt{2}\omega_{c}^{\text{n}}s^{n}+\omega_{ c}^{2n}}, \tag{16}\]

where \(\omega_{c}=\sqrt{\omega_{L}\cdot\omega_{H}}\) represents the center frequency derived from the low and high cutoff frequencies, s represents the complex frequency variable, and n is the filter order. After filtering, signals were evaluated for quality, and those with unidentifiable key features were discarded. After filtering, signals were evaluated for quality, and corrupted signals were excluded based on the clarity of vital features like systolic peaks. Cleaned signals were processed for peak detection using [PERSON]'s algorithm [41], as outlined in the flowchart in Figure 5. The algorithm amplifies systolic peaks by squaring the positive signal values, applies moving averages for smoothing and adaptive thresholding, and identifies the most prominent peak within each waveform. To ensure accuracy, a minimum interval between consecutive peaks was enforced, preventing false detections within a single cardiac cycle. Figure 3: General scheme of the proposed model for non-invasive BGL estimation where the study contribution is highlighted in red color. Finally, the processed signals were analyzed to calculate the time interval (period) between consecutive systolic peaks. This interval was used to derive the Heart Rate (HR) in beats per minute (bpm) by dividing 60 by the period. From the calculated HR, the PPG Rate Mean (average HR) and PPG Rate Standard Deviation were determined, providing essential metrics for subsequent analysis. Figure 6 illustrates this process, highlighting how these metrics are extracted from the pre-processed PPG signals, ensuring the data are effectively prepared for feature extraction and machine learning analysis. #### 4.1.3 Feature Extraction

HRV parameters, which are strongly associated with cardiovascular and autonomic nervous system responses, exhibit significant correlations with BGLs [11; 13; 14; 15; 16; 17; 18; 19; 20; 21]. Leveraging this relationship, HRV metrics derived from PPG signals were extracted to predict BGL non-invasively using ML algorithms. HRV features were categorized into time-domain, frequency-domain, and non-linear domains [43]. Time-domain features, such as the root mean square of successive differences (RMSSD) of peak-to-peak intervals (PPIs), capture temporal variations. Frequency-domain features, derived using methods like the Poincare plot and Detrended Fluctuation Analysis (DFA), describe the distribution and correlations of HRV metrics, while non-linear methods

Figure 4: PPG signals with different qualities: a signal with both baseline variations and high-frequency noises (**left**), a signal with baseline variations (**middle**), and a good one with a little baseline variation (**right**). Figure 5: Flowchart for systolic peak time-domain detection algorithm consists of three main stages: preprocessing (bandpass filter), feature extraction (two moving averages), and classification (threshold).