Abstract
Stress is the mood of pressure and tension that a person feels. Usually, when the pressure on an individual decrease, the body begins to stabilize the state and calm down. Hence, stress detection in real-time is a critical duty in medical systems. However, acquiring physiological data requires additional equipment and is difficult for users to carry with them at all times. Depending on this problem, it is possible to detect stress through behavioral data. Smartphones are devices that provide various behavioral data that people use constantly throughout the day. In this study, a real-time stress detection system based on soft keyboard typing behaviors was developed with the data obtained from linear acceleration, gravity, gyroscope sensors, and a touchscreen panel of the smartphone. 172 attributes were extracted from the raw sensor data. However, such a high number of dimensions could negatively affect the performance of machine learning algorithms. To address this problem, the number of features was reduced by various techniques such as filter-based methods and standard binary-code chromosome Genetic Algorithm as a contribution to this study. Then, writing behaviors were classified with the commonly used machine learning methods namely, C4.5, kNN, and Bayesian Networks. As a result of the experiments, the best classification was obtained from the kNN method using the features selected by the Genetic Algorithm with a classification accuracy of 89.61% and F-Measure of 0.9052. Another contribution of this study is that a mobile service and a relaxation application were developed for stress detection and to reduce stress levels using the selected feature vector.
Similar content being viewed by others
References
Akkucuk U (2011) Veri Madenciliği Kümeleme ve Sınıflama Algoritmaları. Yalın Publishing, İstanbul
Akmandor AO, Jha NK (2017) Keep the stress away with SoDA: stress detection and alleviation system. IEEE Trans Multi-Scale Comput Syst 3(4):269–282. https://doi.org/10.1109/TMSCS.2017.2703613
Alberdi A, Aztiria A, Basarab A (2016) Towards an automatic early stress recognition system for office environments based on multimodal measurements: A review. J Biomed Inform 59:49–75. https://doi.org/10.1016/j.jbi.2015.11.007
Ali ABA, Ponnusamy V, Sangodiah A, Alroobaea R, Jhanjhi NZ, Ghosh U, Masud M (2021) Smartphone security using swipe behavior-based authentication. Int Autom Soft Comput 29(2):571–585. https://doi.org/10.32604/iasc.2021.015913
Android (2020) AccessibilityService. https://developer.android.com/reference/android/accessibilityservice/AccessibilityService. Accessed 14 Apr 2020
Android (2021) Notifications Overview. https://developer.android.com/guide/topics/ui/notifiers/notifications. Accessed 14 Jan 2021
Antistres (2021) Antistres. https://play.google.com/store/apps/details?id=com.relextro.anti.stress.games . Accessed 14 May 2021
Antistress (2021) Antistress. https://play.google.com/store/apps/details?id=com.JindoBlu.Antistress&hl=tr&gl=US . Accessed 14 May 2021
Arsalan A, Majid M (2021) Human stress classification during public speaking using physiological signals. Comput Biol Med 133:104377. https://doi.org/10.1016/j.compbiomed.2021.104377
Asif A, Majid M, Anwar SM (2019) Human stress classification using EEG signals in response to music tracks. Comput Biol Med 107:182–196. https://doi.org/10.1016/j.compbiomed.2019.02.015
Asiri S (2018) Machine Learning Classifiers. https://towardsdatascience.com/machine-learning-classifiers-a5cc4e1b0623. Accessed 4 Apr 2020
Bakker J, Holenderski L, Kocielnik R, Pechenizkiy M, Sidorova N (2012) Stess@ work: from measuring stress to its understanding, prediction and handling with personalized coaching. In proceedings of the 2nd ACM SIGHIT international health informatics symposium (pp. 673-678). https://doi.org/10.1145/2110363.2110439
Ballı S (2021) Data analysis of Covid-19 pandemic and short-term cumulative case forecasting using machine learning time series methods. Chaos, Solitons Fractals 142:110512. https://doi.org/10.1016/j.chaos.2020.110512
Ballı S, Özdemir E (2021) A novel method for prediction of EuroLeague game results using hybrid feature extraction and machine learning techniques. Chaos, Solitons Fractals 150:111119. https://doi.org/10.1016/j.chaos.2021.111119
Beyki M, Yaghoobi M (2015) Chaotic logic gate: A new approach in set and design by genetic algorithm. Chaos, Solitons Fractals 77:247–252. https://doi.org/10.1016/j.chaos.2015.05.032
Bogomolov A, Lepri B, Ferron M, Pianesi F, Pentland A (2014) Daily stress recognition from mobile phone data, weather conditions and individual traits. In proceedings of the 22nd ACM international conference on multimedia (pp. 477-486). https://doi.org/10.1145/2647868.2654933
Can YS, Arnrich B, Ersoy C (2019) Stress detection in daily life scenarios using smart phones and wearable sensors: A survey. J Biomed Inform 92:103139. https://doi.org/10.1016/j.jbi.2019.103139
Can YS, Chalabianloo N, Ekiz D, Fernandez-Alvarez J, Riva G, Ersoy C (2020) Personal stress-level clustering and decision-level smoothing to enhance the performance of ambulatory stress detection with smartwatches. IEEE Access 8:38146–38163. https://doi.org/10.1109/ACCESS.2020.2975351
Chen K, Fink W, Roveda J, Lane RD, Allen J, Vanuk J (2015) Wearable sensor based stress management using integrated respiratory and ECG waveforms. In 2015 IEEE 12th international conference on wearable and implantable body sensor networks (BSN) (pp. 1–6). IEEE. https://doi.org/10.1109/BSN.2015.7299369
Cheng P, Lucero A, Buur J (2016) PAUSE: exploring mindful touch interaction on smartphones. In proceedings of the 20th international academic Mindtrek conference (pp. 184-191). https://doi.org/10.1145/2994310.2994342
Cho Y, Bianchi-Berthouze N, Julier SJ (2017) DeepBreath: deep learning of breathing patterns for automatic stress recognition using low-cost thermal imaging in unconstrained settings. In 2017 seventh international conference on affective computing and intelligent interaction (ACII) (pp. 456–463). IEEE. https://doi.org/10.1109/ACII.2017.8273639
Choi J, Ahmed B, Gutierrez-Osuna R (2011) Development and evaluation of an ambulatory stress monitor based on wearable sensors. IEEE Trans Inf Technol Biomed 16(2):279–286. https://doi.org/10.1109/TITB.2011.2169804
Çinicioğlu EN, Önsel Ekici Ş, Ülengin F (2015) Bayes ağ yapısının oluşturulmasında farklı yaklaşımlar: Nedensel Bayes ağları ve veriden ağ öğrenme. Halil Sarıaslan Armağan Kitap. Publisher: Siyasal Kitabevi-Ünal Sevindik
Çökük B (2018) The measurement of organizational stress level and its relationship with demographic variables: A public organization sample. J Acad Approaches 9(2):59–83
Coutts LV, Plans D, Brown AW, Collomosse J (2020) Deep learning with wearable based heart rate variability for prediction of mental and general health. J Biomed Inform 112:103610. https://doi.org/10.1016/j.jbi.2020.103610
Ferdous R, Osmani V, Mayora O (2015) Smartphone app usage as a predictor of perceived stress levels at workplace. In 2015 9th international conference on pervasive computing Technologies for Healthcare (PervasiveHealth) (pp. 225–228). IEEE. https://doi.org/10.4108/icst.pervasivehealth.2015.260192
Gao Y, Bianchi-Berthouze N, Meng H (2012) What does touch tell us about emotions in touchscreen-based gameplay? ACM Trans Comput-Human Interact (TOCHI) 19(4):1–30. https://doi.org/10.1145/2395131.2395138
Garcia-Ceja E, Osmani V, Mayora O (2015) Automatic stress detection in working environments from smartphones’ accelerometer data: a first step. IEEE J Biomed Health Inf 20(4):1053–1060. https://doi.org/10.1109/JBHI.2015.2446195
Ghosh S, Ganguly N, Mitra B, De P (2017) Tapsense: combining self-report patterns and typing characteristics for smartphone based emotion detection. In proceedings of the 19th international conference on human-computer interaction with Mobile devices and services (pp. 1-12). https://doi.org/10.1145/3098279.3098564
Ghosh S, Sahu S, Ganguly N, Mitra B, De P (2019) EmoKey: an emotion-aware smartphone keyboard for mental health monitoring. In 2019 11th international conference on communication systems & networks (COMSNETS) (pp. 496–499). IEEE. https://doi.org/10.1109/COMSNETS.2019.8711078
Gimpel H, Regal C, Schmidt, M (2015) myStress: unobtrusive smartphone-based stress detection, Eur Conf Inf Syst, 1–12
Gjoreski M, Gjoreski H, Lutrek M, Gams M (2015) Automatic detection of perceived stress in campus students using smartphones. In 2015 international conference on intelligent environments (pp. 132–135). IEEE. https://doi.org/10.1109/IE.2015.27
Gjoreski M, Gjoreski H, Luštrek M, Gams M (2016) Continuous stress detection using a wrist device: in laboratory and real life. In proceedings of the 2016 ACM international joint conference on pervasive and ubiquitous computing: adjunct (pp. 1185-1193). https://doi.org/10.1145/2968219.2968306
Gjoreski M, Luštrek M, Gams M, Gjoreski H (2017) Monitoring stress with a wrist device using context. J Biomed Inform 73:159–170. https://doi.org/10.1016/j.jbi.2017.08.006
Gokalp O, Tasci E, Ugur A (2020) A novel wrapper feature selection algorithm based on iterated greedy metaheuristic for sentiment classification. Expert Syst Appl 146:113176. https://doi.org/10.1016/j.eswa.2020.113176
Hadi WE, El-Khalili N, AlNashashibi M, Issa G, AlBanna AA (2019) Application of data mining algorithms for improving stress prediction of automobile drivers: A case study in Jordan. Comput Biol Med 114:103474. https://doi.org/10.1016/j.compbiomed.2019.103474
Hall MA (1999) Correlation-based feature selection for machine learning, PhD Thesis, The University of Waikato, 178p
Han H, Byun K, Kang HG (2018) A deep learning-based stress detection algorithm with speech signal. In proceedings of the 2018 workshop on audio-visual scene understanding for immersive multimedia (pp. 11-15). https://doi.org/10.1145/3264869.3264875
Holland JH (1992) Adaptation in natural and artificial systems: an introductory analysis with applications to biology, control, and artificial intelligence. MIT press, London
Hollis V, Konrad A, Springer A, Antoun M, Antoun C, Martin R, Whittaker S (2017) What does all this data mean for my future mood? Actionable analytics and targeted reflection for emotional well-being. Hum Comput Interact 32(5–6):208–267. https://doi.org/10.1080/07370024.2016.1277724
Inner Balance (2020) Inner Balance. https://apps.apple.com/us/app/inner-balance/id569278747. Accessed 15 Apr 2020
Karegowda AG, Manjunath AS, Jayaram MA (2010) Comparative study of attribute selection using gain ratio and correlation based feature selection. Int J Inf Technol Knowl Manag 2(2):271–277
Kim HJ, Choi YS (2012) Exploring emotional preference for smartphone applications. In 2012 IEEE consumer communications and networking conference (CCNC) (pp. 245–249). IEEE. https://doi.org/10.1109/CCNC.2012.6181095
Kononenko I (1994) Estimating attributes: analysis and extensions of RELIEF. In: European conference on machine learning. Springer, Berlin, Heidelberg, pp 171–182. https://doi.org/10.1007/3-540-57868-4_57
Kostopoulos P, Kyritsis AI, Deriaz M, Konstantas D (2017) Stress detection using smart phone data. In: In eHealth 360°. Springer, Cham, pp 340–351. https://doi.org/10.1007/978-3-319-49655-9_41
Lahmiri S, Bekiros S (2020) Intelligent forecasting with machine learning trading systems in chaotic intraday bitcoin market. Chaos, Solitons Fractals 133:109641. https://doi.org/10.1016/j.chaos.2020.109641
Lee H, Choi YS, Lee S, Park IP (2012) Towards unobtrusive emotion recognition for affective social communication. In 2012 IEEE consumer communications and networking conference (CCNC) (pp. 260–264). IEEE. https://doi.org/10.1109/CCNC.2012.6181098
Lu H, Frauendorfer D, Rabbi M, Mast MS, Chittaranjan GT, Campbell AT, Gatica-Perez D, Choudhury T (2012) Stresssense: detecting stress in unconstrained acoustic environments using smartphones. In proceedings of the 2012 ACM conference on ubiquitous computing (pp. 351-360). https://doi.org/10.1145/2370216.2370270
Maxhuni A, Hernandez-Leal P, Sucar LE, Osmani V, Morales EF, Mayora O (2016) Stress modelling and prediction in presence of scarce data. J Biomed Inform 63:344–356. https://doi.org/10.1016/j.jbi.2016.08.023
Minguillon J, Perez E, Lopez-Gordo MA, Pelayo F, Sanchez-Carrion MJ (2018) Portable system for real-time detection of stress level. Sensors 18(8):2504. https://doi.org/10.3390/s18082504
Mou L, Zhou C, Zhao P, Nakisa B, Rastgoo MN, Jain R, Gao W (2021) Driver stress detection via multimodal fusion using attention-based CNN-LSTM. Expert Syst Appl 173:114693. https://doi.org/10.1016/j.eswa.2021.114693
Muaremi A, Arnrich B, Tröster G (2013) Towards measuring stress with smartphones and wearable devices during workday and sleep. Bio Nano Sci 3(2):172–183. https://doi.org/10.1007/s12668-013-0089-2
Onan A, Korukoğlu, S, (2016) Filter-based feature selection methods in text classification, Acad Comput, 59–66
Padmaja B, Prasad VR, Sunitha KV (2018) A machine learning approach for stress detection using a wireless physical activity tracker. Int J Mach Learn Comput 8:33–38. https://doi.org/10.1145/2968219.2968306
Pandey PS (2017) Machine learning and IoT for prediction and detection of stress. In 2017 17th international conference on computational science and its applications (ICCSA) (pp. 1–5). IEEE. https://doi.org/10.1109/ICCSA.2017.8000018
Panganiban, FC, de Leon, FA (2021) Stress detection using smartphone extracted Photoplethysmography. In 2021 IEEE region 10 symposium (TENSYMP) (pp. 1–7). IEEE. https://doi.org/10.1109/TENSYMP52854.2021.9550905
Pause (2020) Pause: daily mindfulness. https://apps.apple.com/us/app/pause-relaxation-at-your-fingertip/id991764216. Accessed 15 Apr 2020
Pearl J (1988) Probabilistic reasoning in intelligent systems, San Mateo, CA: Kaufmann, 1988, pp. 33–34
Peker M, Arslan A, Şen B, Çelebi FV, But A (2015) A novel hybrid method for determining the depth of anesthesia level: combining ReliefF feature selection and random forest algorithm (ReliefF+ RF). In 2015 international symposium on innovations in intelligent SysTems and applications (INISTA) (pp. 1–8). IEEE. https://doi.org/10.1109/INISTA.2015.7276737
Plarre K, Raij A, Hossain SM, Ali AA, Nakajima M, Al’Absi M, Ertin E, Kamarck T, Kumar S, Scott M, Siewiorek D, Smailagic A, Wittmers LE (2011) Continuous inference of psychological stress from sensory measurements collected in the natural environment. In proceedings of the 10th ACM/IEEE international conference on information processing in sensor networks (pp. 97-108). IEEE
Prana Breath (2021) Prana Breath. Google Play Store. https://play.google.com/store/apps/details?id=com.abdula.pranabreath&hl=tr&gl=US. Accessed 14 May 2021
Quinlan JR (1992) C4.5: programs for machine learning. Morgan Kaufmann, San Fransisco
Sağbaş EA, Ballı S (2015) Usage of the smartphone sensors and accessing raw sensor data. Acad Comput:158–164
Sağbaş EA, Gökalp O, Uğur A (2019) Feature extraction based on distance ratio and selection with genetic algorithms for facial expression recognition. J Data Sci 2(1):19–29
Sağbaş EA, Korukoglu S, Balli S (2020) Stress detection via keyboard typing behaviors by using smartphone sensors and machine learning techniques. J Med Syst 44(4):1–12. https://doi.org/10.1007/s10916-020-1530-z
Şen B, Peker M, Çavuşoğlu A, Çelebi FV (2014) A comparative study on classification of sleep stage based on EEG signals using feature selection and classification algorithms. J Med Syst 38(3):1–21. https://doi.org/10.1007/s10916-014-0018-0
Shaikh R (2018) Feature Selection Techniques in Machine Learning with Python. Medium Publishing. https://towardsdatascience.com/feature-selection-techniques-in-machine-learning-with-python-f24e7da3f36e. Accessed 4 Apr 2020
Sharma S, Singh G, Sharma M (2021) A comprehensive review and analysis of supervised-learning and soft computing techniques for stress diagnosis in humans. Comput Biol Med, 104450. https://doi.org/10.1016/j.compbiomed.2021.104450
Sysoev M, Kos A, Pogačnik M (2015) Noninvasive stress recognition considering the current activity. Pers Ubiquit Comput 19(7):1045–1052. https://doi.org/10.1007/s00779-015-0885-5
Tervonen J, Puttonen S, Sillanpää MJ, Hopsu L, Homorodi Z, Keränen J, … Mäntyjärvi J (2020) Personalized mental stress detection with self-organizing map: from laboratory to the field. Comput Biol Med 124:103935. https://doi.org/10.1016/j.compbiomed.2020.103935
Thapliyal H, Khalus V, Labrado C (2017) Stress detection and management: A survey of wearable smart health devices. IEEE Consum Electron Mag 6(4):64–69. https://doi.org/10.1109/MCE.2017.2715578
Vildjiounaite E, Kallio J, Kyllönen V, Nieminen M, Määttänen I, Lindholm M, Mäntyjärvi J, Gimel'farb G (2018) Unobtrusive stress detection on the basis of smartphone usage data. Pers Ubiquit Comput 22(4):671–688. https://doi.org/10.1007/s00779-017-1108-z
Wang R, Chen F, Chen Z, Li T, Harari G, Tignor S, Zhou X, Ben-Zeev D, Campbell AT (2014) StudentLife: assessing mental health, academic performance and behavioral trends of college students using smartphones. In proceedings of the 2014 ACM international joint conference on pervasive and ubiquitous computing (pp. 3-14). https://doi.org/10.1145/2632048.2632054
Watchmaker Framework for Evolutionary Computation (2022) https://watchmaker.uncommons.org/. Accessed 11 Apr 2022
Weka 3: Machine Learning Software in Java (2022) https://www.cs.waikato.ac.nz/ml/weka/. Accessed 14 Apr 2022
Witten IH, Frank E (2002) Data mining: practical machine learning tools and techniques with Java implementations. ACM SIGMOD Rec 31(1):76–77
Yargholi E, Hossein-Zadeh GA (2019) Cross recurrence quantifiers as new connectivity measures for structure learning of Bayesian networks in brain decoding. Chaos, Solitons Fractals 123:263–274. https://doi.org/10.1016/j.chaos.2019.04.019
Yazıcı B, Yaslı F, Gürleyik HY, Yurgut UO, Aktas MS, Kalıpsız O (2015) Veri Madenciliğinde Özellik Seçim Tekniklerinin Bankacılık Verisine Uygulanması Üzerine Araştırma ve Karşılaştırmalı Uygulama, 9. Ulusal Yazılım Mühendisliği Sempozyumu, 9–11
Yuksel AS, Senel FA, Cankaya IA (2018) Classification of writing behaviors using mobile device sensors. Dicle Univ J Eng 9(1):133–142
Yuksel AS, Senel FA, Cankaya IA (2019) Classification of soft keyboard typing behaviors using Mobile device sensors with machine learning. Arab J Sci Eng 44(4):3929–3942. https://doi.org/10.1007/s13369-018-03703-8
Zaman N, Almusalli FA (2017) Smartphones power consumption & energy saving techniques. In 2017 international conference on innovations in electrical engineering and computational technologies (ICIEECT) (pp. 1–7). IEEE. https://doi.org/10.1109/ICIEECT.2017.7916593
Zenonos A, Khan A, Kalogridis G, Vatsikas S, Lewis T, Sooriyabandara M (2016) HealthyOffice: mood recognition at work using smartphones and wearable sensors. In 2016 IEEE international conference on pervasive computing and communication workshops (PerCom workshops) (pp. 1–6). IEEE. https://doi.org/10.1109/PERCOMW.2016.7457166
Zhang H, Cao L, Feng L, Yang M (2020) Multi-modal interactive fusion method for detecting teenagers’ psychological stress. J Biomed Inform 106:103427. https://doi.org/10.1016/j.jbi.2020.103427
Zhang P, Li F, Zhao R, Zhou R, Du L, Zhao Z, … Fang Z (2021) Real-time psychological stress detection according to ECG using deep learning. Appl Sci 11(9):3838. https://doi.org/10.3390/app11093838
Zhang P, Li F, Du L, Zhao R, Chen X, Yang T, Fang Z (2021) Psychological stress detection according to ECG using a deep learning model with attention mechanism. Appl Sci 11(6):2848. https://doi.org/10.3390/app11062848
Acknowledgments
The authors would like to thank the personnel and undergraduate students of the Computer Engineering Department of Ege University for volunteering to participate in the experiment phase of this study.
Author information
Authors and Affiliations
Corresponding author
Ethics declarations
Competing interests
The authors declare that they have no known competing financial interests or personal relationships that could have appeared to influence the work reported in this paper.
Ethics approval
All procedures performed in studies involving human participants were in accordance with the ethical standards of the institutional and/or national research committee and with the 1964 Helsinki declaration and its later amendments or comparable ethical standards. The study was reviewed and approved by the Scientific Research and Publication Ethics Boards, Ege University (Ethics approval protocol number: 11/01–362, date: 26.11.2019).
Additional information
Publisher’s note
Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.
Rights and permissions
Springer Nature or its licensor (e.g. a society or other partner) holds exclusive rights to this article under a publishing agreement with the author(s) or other rightsholder(s); author self-archiving of the accepted manuscript version of this article is solely governed by the terms of such publishing agreement and applicable law.
About this article
Cite this article
Sağbaş, E.A., Korukoglu, S. & Ballı, S. Real-time stress detection from smartphone sensor data using genetic algorithm-based feature subset optimization and k-nearest neighbor algorithm. Multimed Tools Appl 83, 1–32 (2024). https://doi.org/10.1007/s11042-023-15706-1
Received:
Revised:
Accepted:
Published:
Issue Date:
DOI: https://doi.org/10.1007/s11042-023-15706-1