4.8. Model Development
This section outlines the implementation of a machine learning pipeline to classify stress states from EEG and ECG data. The model development process is illustrated in the following Figure 10.

The process begins by loading the cleaned data and defining features (X) from EEG and ECG metrics and the binary stress label (y). The data is split into training and testing sets, with GroupKFold used to maintain participant data consistency across folds, preventing data from the same individual appearing in both training and testing sets.
The primary model, RandomForestClassifier, is tuned with 100 estimators, followed by model training and performance evaluation on the test set. This setup also incorporates multiple classifiers, including SVM, Decision Trees, and Neural Networks, each evaluated through cross-validation. For each classifier, metrics such as accuracy and runtime are computed and stored in a DataFrame. The results inform the selection of the best classifier for stress detection based on physiological signals.
Last updated