Machine Learning-Based Lifestyle Analysis for Health Risk Detection in Coffee Drinkers

Authors

  • Sri Winiarti Universitas Ahmad Dahlan
  • Ahmad Azhari Universitas Ahmad Dahlan
  • Nathaniela Isya Nur Rofiah Universitas Ahmad Dahlan

DOI:

https://doi.org/10.12928/mf.v8i2.16102

Keywords:

Random Forest, Gradient Boosting, Machine Learning, Lifestyle Analysis, Health Risks

Abstract

This study aims to develop a machine learning-based intelligent system to detect health risks in coffee drinkers through a lifestyle analysis approach. The background of this study is based on the increasing consumption of coffee as part of a modern lifestyle, which has the potential to cause various health risks if not balanced with a healthy lifestyle. The dataset was collected through a survey covering several important variables, such as coffee consumption frequency, sugar intake, sleep duration, physical activity level, body mass index (BMI), and blood pressure.

The research stages included data preprocessing, normalization, and classification using three algorithms: Random Forest and Gradient Boosting. Model performance was evaluated using accuracy, precision, recall, and F1-score metrics to ensure the system’s reliability. Test results showed that the Random Forest algorithm performed best with an accuracy of 0.91, followed by Gradient Boosting with an accuracy of 0.90.

Further analysis revealed that the variables most influential on health risks are coffee consumption frequency, sleep duration, and sugar intake. The developed system proved effective in detecting health risks early and has the potential to serve as a data-driven educational tool to raise public awareness of the importance of a healthy lifestyle.

References

T. Khater, H. Tawfik, and B. Singh, “Explainable artificial intelligence for investigating the effect of lifestyle factors on obesity,” Intell. Syst. Appl., vol. 23, p. 200427, Sep. 2024, doi: 10.1016/j.iswa.2024.200427.

J. Schlichtiger, S. Brunner, A. Strüven, J. M. Hoppe, and C. Stremmel, “Effects of Caffeine Intake on Self-Administered Sleeping Quality and Wearable Monitoring of Sleep in a Cohort of Young Healthy Adults,” Nutrients, vol. 17, no. 9, p. 1503, Apr. 2025, doi: 10.3390/nu17091503.

Z. Gaeini, Z. Bahadoran, P. Mirmiran, and F. Azizi, “Tea, coffee, caffeine intake and the risk of cardio-metabolic outcomes: findings from a population with low coffee and high tea consumption,” Nutr. Metab., vol. 16, no. 1, p. 28, Dec. 2019, doi: 10.1186/s12986-019-0355-6.

X.-X. Wang, C.-Y. Cao, X.-F. Wang, X.-Y. Wang, H.-B. Tong, and Y.-F. Liu, “Investigating the genetic and causal relationship between coffee/caffeine consumption and stroke: genome-wide association and bidirectional Mendelian randomization study,” Cereb. Cortex, vol. 35, no. 9, p. bhaf265, Sep. 2025, doi: 10.1093/cercor/bhaf265.

M. F. Mendoza, R. M. Sulague, T. Posas-Mendoza, and C. J. Lavie, “Impact of Coffee Consumption on Cardiovascular Health,” Ochsner J., vol. 23, no. 2, pp. 152–158, 2023, doi: 10.31486/toj.22.0073.

A. D. Ahmadabad, L. Jahangiry, N. Gilani, M. A. Farhangi, E. Mohammadi, and K. Ponnet, “Lifestyle patterns, nutritional, and metabolic syndrome determinants in a sample of the older Iranian population,” BMC Geriatr., vol. 24, no. 1, p. 36, Jan. 2024, doi: 10.1186/s12877-024-04659-1.

A. Azwana and R. S. Siregar, “Analisis Kualitatif Preferensi dan Nilai Konsumsi Kopi pada Generasi Urban di Kecamatan Medan Petisah,” J. Educ. Hum. Soc. Sci. JEHSS, vol. 8, no. 3, pp. 1430–1438, Feb. 2026, doi: 10.34007/jehss.v8i3.2945.

A. F. Ramadhani and M. N. Dwiputri, “Karakteristik Pola Konsumsi Produk Kopi dan Estimasi Paparan Kafein Harian Pada Kelompok Dewasa Awal: Studi Korelasi Terhadap Indikator Stres,” J. Sains Dan Teknol. Pangan, vol. 11, no. 1, Feb. 2026, doi: 10.63071/cgkvp824.

M. Maulidah and N. Hidayati, “Prediksi Kesehatan Tidur dan Gaya Hidup Menggunakan Machine Learning,” CONTEN Comput. Netw. Technol., vol. 4, no. 1, pp. 81–86, Dec. 2024, doi: 10.31294/conten.v4i1.4918.

K. Wairimu H., “Integrating Lifestyle Data into Personalized Health Solutions,” Res. Output J. Public Health Med., vol. 5, no. 1, pp. 100–106, 2025, doi: 10.59298/ROJPHM/2025/51100106.

M. G. Sghaireen et al., “Machine Learning Approach for Metabolic Syndrome Diagnosis Using Explainable Data-Augmentation-Based Classification,” Diagnostics, vol. 12, no. 12, p. 3117, Dec. 2022, doi: 10.3390/diagnostics12123117.

S. Patidar, D. Kumar, and D. Rukwal, “Comparative Analysis of Machine Learning Algorithms for Heart Disease Prediction,” in Advances in Transdisciplinary Engineering, R. M. Singari and P. K. Kankar, Eds., IOS Press, 2022. doi: 10.3233/ATDE220723.

S. M. Abdulrahman, M. Rashid, and F. Al-Hashimi, “Optimized deep learning architectures for the classification of colorectal cancer diagnosis using whole slide images,” PeerJ Comput. Sci., vol. 11, p. e3241, Nov. 2025, doi: 10.7717/peerj-cs.3241.

G. Airlangga, “Comparative Analysis of Machine Learning Models for Chronic Disease Indicator Classification Using U.S. Chronic Disease Indicators Dataset,” MALCOM Indones. J. Mach. Learn. Comput. Sci., vol. 4, no. 3, pp. 1034–1042, Jun. 2024, doi: 10.57152/malcom.v4i3.1403.

T. Paul, M. Assaduzzaman, N. Fahad, and M. J. Hossen, “Enhancing risk prediction for diabetes, hypertension, and heart disease using SMOTE-ENN balancing with PCA and gradient boosting in healthcare AI,” Intell.-Based Med., vol. 13, p. 100339, Mar. 2026, doi: 10.1016/j.ibmed.2025.100339.

M. Salimparsa, K. Sedig, D. J. Lizotte, S. S. Abdullah, N. Chalabianloo, and F. T. Muanda, “Explainable AI for Clinical Decision Support Systems: Literature Review, Key Gaps, and Research Synthesis,” Informatics, vol. 12, no. 4, p. 119, Oct. 2025, doi: 10.3390/informatics12040119.

A. Jovic, N. Frid, K. Brkic, and M. Cifrek, “Interpretability and accuracy of machine learning algorithms for biomedical time series analysis – a scoping review,” Biomed. Signal Process. Control, vol. 110, p. 108153, Dec. 2025, doi: 10.1016/j.bspc.2025.108153.

M. R. Khadiki and V. A. Fitria, “Klasifikasi Penyakit Ginjal Kronis Menggunakan K-Nearest Neighbors dengan Feature selection Pearson Correlation Coefficient,” J. Inf. Syst. Res. JOSH, vol. 6, no. 3, pp. 1767–1776, Apr. 2025, doi: 10.47065/josh.v6i3.7131.

S. M. S. Islam et al., “Machine Learning Approaches for Predicting Hypertension and Its Associated Factors Using Population-Level Data From Three South Asian Countries,” Front. Cardiovasc. Med., vol. 9, p. 839379, Mar. 2022, doi: 10.3389/fcvm.2022.839379.

M. J. Corbi-Cobo-Losey et al., “Coffee Consumption and the Risk of Metabolic Syndrome in the ‘Seguimiento Universidad de Navarra’ Project,” Antioxidants, vol. 12, no. 3, p. 686, Mar. 2023, doi: 10.3390/antiox12030686.

A. Higuera-Gómez et al., “Computational algorithm based on health and lifestyle traits to categorize lifemetabotypes in the NUTRiMDEA cohort,” Sci. Rep., vol. 14, no. 1, p. 24835, Oct. 2024, doi: 10.1038/s41598-024-75110-z.

H.-J. Kim et al., “Machine Learning–Based Analysis of Lifestyle Risk Factors for Atherosclerotic Cardiovascular Disease: Retrospective Case-Control Study,” JMIR Med. Inform., vol. 13, pp. e74415–e74415, Aug. 2025, doi: 10.2196/74415.

Z. Ungvari and S. K. Kunutsor, “Coffee consumption and cardiometabolic health: a comprehensive review of the evidence,” GeroScience, vol. 46, no. 6, pp. 6473–6510, Jul. 2024, doi: 10.1007/s11357-024-01262-5.

S. Tuly, S. Majumder, A. Chowdhury, A. Habib, and S. A. Suha, “Predicting Heart Disease Risk with Lifestyle Factors: Uncovering Vital Predictors via Feature Selection and Machine Learning Techniques,” in Proceedings of the 3rd International Conference on Computing Advancements, Dhaka Bangladesh: ACM, Oct. 2024, pp. 466–473. doi: 10.1145/3723178.3723240.

J. R. Holt et al., “Enhancing Health Research with Machine Learning: Practical Case Studies Using the All of Us Researcher Workbench,” Data Sci. Sci., vol. 4, no. 1, p. 2523871, Dec. 2025, doi: 10.1080/26941899.2025.2523871.

D. Dixon et al., “Unveiling the Influence of AI Predictive Analytics on Patient Outcomes: A Comprehensive Narrative Review,” Cureus, May 2024, doi: 10.7759/cureus.59954.

S. Hanifa and K. E. Wicaksono, “Digital Transformation of Health Services in Indonesia through the Utilization of Artificial Intelligence, Big Data, and Telemedicine: Systematic Literature Review-VOSviewer,” Proceeding Int. Conf. Inov. Sci. Technol. Educ. Child. Health, vol. 5, no. 1, pp. 181–192, Jun. 2025, doi: 10.62951/icistech.v5i1.280.

M. F. Wibowo, A. Pyle, E. Lim, J. W. Ohde, N. Liu, and J. Karlström, “Insights Into the Current and Future State of AI Adoption Within Health Systems in Southeast Asia: Cross-Sectional Qualitative Study,” J. Med. Internet Res., vol. 27, p. e71591, Jun. 2025, doi: 10.2196/71591.

E. Wianto, H. Toba, C.-H. Chen, and M. Malinda, “Sensor-based Data Acquisition via Ubiquitous Device to Detect Muscle Strength Training Activities,” presented at the AHFE 2023 Hawaii Edition, 2023. doi: 10.54941/ahfe1004213.

N. Crane, C. Hagerman, O. Horgan, and M. Butryn, “Patterns and Predictors of Engagement With Digital Self-Monitoring During the Maintenance Phase of a Behavioral Weight Loss Program: Quantitative Study,” JMIR MHealth UHealth, vol. 11, p. e45057, Jul. 2023, doi: 10.2196/45057.

F. Di Martino, F. Delmastro, and C. Dolciotti, “Explainable AI for malnutrition risk prediction from m-Health and clinical data,” Smart Health, vol. 30, p. 100429, Dec. 2023, doi: 10.1016/j.smhl.2023.100429.

B. Zhou et al., “Clustering of lifestyle behaviours and analysis of their associations with MAFLD: a cross-sectional study of 196,515 individuals in China,” BMC Public Health, vol. 23, no. 1, p. 2303, Nov. 2023, doi: 10.1186/s12889-023-17177-3.

S. Ahmadi and N. Wening, “The Role of Artificial Intelligence for Medical Professionals in Indonesia: A Systematic Literature Review,” J. Soc. Sci. JoSS, vol. 4, no. 4, pp. 218–227, May 2025, doi: 10.57185/joss.v4i4.437.

J.-H. Jeong, I.-G. Lee, S.-K. Kim, T.-E. Kam, S.-W. Lee, and E. Lee, “DeepHealthNet: Adolescent Obesity Prediction System Based on a Deep Learning Framework,” IEEE J. Biomed. Health Inform., vol. 28, no. 4, pp. 2282–2293, Apr. 2024, doi: 10.1109/JBHI.2024.3356580.

M. H. Kurniawan, H. Handiyani, T. Nuraini, and R. T. S. Hariyati, “Artificial Intelligence (AI) in Nursing Services: A Literature Review,” Faletehan Health J., vol. 10, no. 01, pp. 77–84, Apr. 2023, doi: 10.33746/fhj.v10i01.556.

P. H. Trenggono and A. Bachtiar, “Peran Artificial Intelligence Dalam Pelayanan Kesehatan : A Systematic Review,” J. Ners, vol. 7, no. 1, pp. 444–451, Apr. 2023, doi: 10.31004/jn.v7i1.13612.

K. Riehl, M. Neunteufel, and M. Hemberg, “Hierarchical confusion matrix for classification performance evaluation,” J. R. Stat. Soc. Ser. C Appl. Stat., vol. 72, no. 5, pp. 1394–1412, Dec. 2023, doi: 10.1093/jrsssc/qlad057.

I. Markoulidakis and G. Markoulidakis, “Probabilistic Confusion Matrix: A Novel Method for Machine Learning Algorithm Generalized Performance Analysis,” Technologies, vol. 12, no. 7, p. 113, Jul. 2024, doi: 10.3390/technologies12070113.

V. Sinap, “A novel hyperparameter tuning method for enhanced intrusion detection in network security,” Turk. J. Eng., vol. 9, no. 3, pp. 519–534, Jul. 2025, doi: 10.31127/tuje.1624366.

S. Sathyanarayanan, “Confusion Matrix-Based Performance Evaluation Metrics,” Afr. J. Biomed. Res., pp. 4023–4031, Nov. 2024, doi: 10.53555/AJBR.v27i4S.4345.

Downloads

Published

2026-07-08

Issue

Section

Articles