  Stress and driving are a dangerous combination which can lead to crashes, as
evidenced by the large number of road traffic crashes that involve stress.
Motivated by the need to address the significant costs of driver stress, it is
essential to build a practical system that can classify driver stress level
with high accuracy. However, the performance of an accurate driving stress
levels classification system depends on hyperparameter optimization choices
such as data segmentation (windowing hyperparameters). The configuration
setting of hyperparameters, which has an enormous impact on the system
performance, are typically hand-tuned while evaluating the algorithm. This
tuning process is time consuming and often depends on personal experience.
There are also no generic optimal values for hyperparameters values. In this
work, we propose a meta-heuristic approach to support automated hyperparameter
optimization and provide a real-time driver stress detection system. This is
the first systematic study of optimizing windowing hyperparameters based on
Electrocardiogram (ECG) signal in the domain of driving safety. Our approach is
to propose a framework based on Particle Swarm Optimization algorithm (PSO) to
select an optimal/near optimal windowing hyperparameters values. The
performance of the proposed framework is evaluated on two datasets: a public
dataset (DRIVEDB dataset) and our collected dataset using an advanced
simulator. DRIVEDB dataset was collected in a real time driving scenario, and
our dataset was collected using an advanced driving simulator in the control
environment. We demonstrate that optimising the windowing hyperparameters
yields significant improvement in terms of accuracy. The most accurate built
model applied to the public dataset and our dataset, based on the selected
windowing hyperparameters, achieved 92.12% and 77.78% accuracy, respectively.
