Data-Driven Stroke Prediction: Leveraging KNN for Early Detection in Clinical Datasets
DOI:
https://doi.org/10.38032/jea.2026.02.002Keywords:
Stroke Prediction,, KNN algorithm, Machine learning, SMOTE, Healthcare analyticsAbstract
This study explores the application of the K-Nearest Neighbors (KNN) algorithm in predicting stroke risk using a healthcare dataset from Kaggle containing 5,110 patient records with demographic and clinical attributes. Preprocessing steps included categorical encoding, normalization, and feature engineering, followed by model training using a pipeline that incorporated SMOTE to address class imbalance. Hyperparameter tuning via GridSearchCV improved model performance. The final KNN model achieved an accuracy of 84%, with a recall of 0.64 and precision of 0.18 for the stroke class, indicating moderate sensitivity but significant false positive rates typical of imbalanced medical datasets. Evaluation metrics included the confusion matrix, ROC curve (AUC = 0.82), and precision-recall curve (AP = 0.19). While the model demonstrates reasonable discriminative ability, the low precision suggests limited utility as a standalone diagnostic tool. These findings contribute to the growing body of research on machine learning for clinical decision support, emphasizing the need for balanced performance metrics in imbalanced datasets and highlighting KNN's potential as a preliminary screening instrument when combined with clinical judgment.
References
[1] Abdelazez, M., Rajan, S. and Chan, A.D., 2020, July. Transfer learning for detection of atrial fibrillation in deterministic compressive sensed ECG. In 2020 42nd Annual International Conference of the IEEE Engineering in Medicine & Biology Society (EMBC) (pp. 5398-5401). IEEE. DOI: https://doi.org/10.1109/EMBC44109.2020.9175813
[2] Chawla, N.V., Bowyer, K.W., Hall, L.O. and Kegelmeyer, W.P., 2002. SMOTE: synthetic minority over-sampling technique. Journal of artificial intelligence research, 16, pp.321-357. DOI: https://doi.org/10.1613/jair.953
[3] Chen, J., Chen, Y., Li, J., Wang, J., Lin, Z. and Nandi, A.K., 2021. Stroke risk prediction with hybrid deep transfer learning framework. IEEE Journal of Biomedical and Health Informatics, 26(1), pp.411-422. DOI: https://doi.org/10.1109/JBHI.2021.3088750
[4] Saito, T. and Rehmsmeier, M., 2015. The precision-recall plot is more informative than the ROC plot when evaluating binary classifiers on imbalanced datasets. PloS one, 10(3), p.e0118432.
[5] Dhamija, S., 2021. Leveraging the machine learning algorithms to efficaciously predict the risk parameters of stroke, Int. J. Res. Med. Sci. Technol., 11(2), pp. 238–246. DOI: https://doi.org/10.37648/ijrmst.v11i02.020
[6] Soladoye, A.A., Aderinto, N., Popoola, M.R., Adeyanju, I.A., Osonuga, A. and Olawade, D.B., 2025. Machine learning techniques for stroke prediction: A systematic review of algorithms, datasets, and regional gaps. International journal of medical informatics, p.106041. DOI: https://doi.org/10.1016/j.ijmedinf.2025.106041
[7] Buda, M., Maki, A. and Mazurowski, M.A., 2018. A systematic study of the class imbalance problem in convolutional neural networks. Neural networks, 106, pp.249-259. DOI: https://doi.org/10.1016/j.neunet.2018.07.011
[8] He, H. and Garcia, E.A., 2009. Learning from imbalanced data. IEEE Transactions on knowledge and data engineering, 21(9), pp.1263-1284. DOI: https://doi.org/10.1109/TKDE.2008.239
[9] Krawczyk, B., 2016. Learning from imbalanced data: open challenges and future directions. Progress in artificial intelligence, 5(4), pp.221-232. DOI: https://doi.org/10.1007/s13748-016-0094-0
[10] Nan, Y., Li, W., Lu, F., Delicato, F.C. and Zomaya, A.Y., 2020, April. Realising edge analytics for early prediction of readmission: a case study. In 2020 IEEE International Conference on Cloud Engineering (IC2E) (pp. 95-104). IEEE. DOI: https://doi.org/10.1109/IC2E48712.2020.00017
[11] Azemin, M.C., Kumar, D.K., Wong, T.Y., Wang, J.J., Kawasaki, R., Mitchell, P. and Arjunan, S.P., 2010, August. Fusion of multiscale wavelet-based fractal analysis on retina image for stroke prediction. In 2010 Annual International Conference of the IEEE Engineering in Medicine and Biology (pp. 4308-4311). IEEE. DOI: https://doi.org/10.1109/IEMBS.2010.5626209
[12] Johnson, K.B., Wei, W.Q., Weeraratne, D., Frisse, M.E., Misulis, K., Rhee, K., Zhao, J. and Snowdon, J.L., 2021. Precision medicine, AI, and the future of personalized health care. Clinical and translational science, 14(1), pp.86-93. DOI: https://doi.org/10.1111/cts.12884
[13] Saito, T. and Rehmsmeier, M., 2015. The precision-recall plot is more informative than the ROC plot when evaluating binary classifiers on imbalanced datasets. PloS one, 10(3), p.e0118432. DOI: https://doi.org/10.1371/journal.pone.0118432
[14] Zhang, S., Wang, J., Pei, L., Liu, K., Gao, Y., Fang, H., Zhang, R., Zhao, L., Sun, S., Wu, J. and Song, B., 2021. Interpretability analysis of one-year mortality prediction for stroke patients based on deep neural network. IEEE Journal of Biomedical and Health Informatics, 26(4), pp.1903-1910. DOI: https://doi.org/10.1109/JBHI.2021.3123657
Downloads
Published
Data Availability Statement
Data will be made available upon reasonable request.
Issue
Section
License
Copyright (c) 2026 Junna Mae Guilao, Arlah Licay, Jheanne Salan, Jose Agoylo

This work is licensed under a Creative Commons Attribution-NonCommercial 4.0 International License.
All the articles published by this journal are licensed under a Creative Commons Attribution-NonCommercial 4.0 International License
