Decoding sensors data using machine learning algorithms to detect an individual’s stress levels

Effectively detecting whether an individual might be stressed could greatly improve a person’s well-being. This would enable us to become aware of, and therefore act upon, anything that might be causing stress. Advancements in the field of digital health enable us to better monitor our well-being towards making any lifestyle changes necessary for enjoying a good and healthy life.

This study seeks to contribute to existing research into the relationship between psychological stress and the body’s vital signs. The approach adopted in achieving this aim was through the use of sensor data and machine learning algorithms.

Since a good relationship between psychological stress and vital signs has already been established, the goal was to collect these vital signs and make sense of them with reference to stress, i.e., process them as necessary in order to effectively detect an individual’s level of stress solely through such readings. The vital signs that were considered throughout the project were electrocardiogram (ECG) readings and skin temperature. The chosen method for this research has also been adopted in other studies; it consists of the following steps: data collection, data cleansing, data processing, and classification.

The project itself was split into two phases, namely: artefact creation and artefact testing. Since the creation of the artefact entailed a substantial amount of data, a public dataset was used. This consisted of physiological data collected from 15 individuals in different mental states. [1]

Sensor data is susceptible to noise from external factors, such as body movement. Hence, filtering was implemented within the artefact, cleansing the signals as much as possible. Once the signals had been cleansed, the solution proceeded to process them as necessary. This is done by making use of popular methodologies that are commonly used to make sense of such data, since raw data is of little use. The metrics inferred from these readings are generally referred to as features. Any data collected during a stressful state was labelled as ‘Stressed’, whilst the data collected when the person was in a relaxed state was labelled as ‘Not stressed’.

These features and their labels were then passed through a number of classification algorithms for training the relevant model. While 80% of the data was used to train the algorithms / model, the remaining 20% was used for testing. Testing with this data yielded substantial results.

An experiment was then carried out following a similar procedure as used in the WESAD dataset [1], for which 5 individuals were chosen to take part in the protocol, using a skin temperature sensor and ECG sensor (see Figure 1) readings were recorded in a baseline state and in a stressed state.

Lastly, the data was passed through the created artefact. Although the results achieved at the time of writing were satisfactory, they suggested that a change in the device used to collect the data, or the lack of variation of participants in the datasets, could affect the level of accuracy of the final results.

Figure 1. Positioning of the ECG and skin-temperature sensors


[1] P. Schmidt, A. Reiss, R. Duerichen, C. Marberger and K. Van Laerhoven, “Introducing WESAD, a Multimodal Dataset for Wearable Stress and Affect Detection”, Proceedings of the 20th ACM International Conference on Multimodal Interaction, 2018. Available: 10.1145/3242969.3242985.

Student: Daniel Azzopardi
Course: B.Sc. IT (Hons.) Software Development
Supervisor: Dr Conrad Attard