Prediction of Diabetes Mellitus using Machine Learning Algorithms: Comparative Analysis of K-Nearest Neighbor, Random Forest and Logistic Regression


  • Adekunle Adeshina Department of Information Technology, University of Ilorin, Ilorin, Nigeria.
  • G.C. Ogwume Department of Information Technology, University of Ilorin, Ilorin, Nigeria.


Diabetes Mellitus, Machine Learning, K-Nearest Neighbor, Random Forest, Logistic Regression


Diabetes Mellitus is a chronic and one of the deadliest diseases. Diabetes disease increases the risk of long-term complications, including heart diseases and kidney failures, among others. Undoubtedly, Diabetes Mellitus patients may live longer and lead healthier lives if the disease is detected early. Over the years, several efforts have been on more accurate and early detection procedures to safe patients of Diabetes Mellitus. Interestingly, with the applications of Information Technology to the disease diagnoses and therapy managements, more attention has been on using machine learning in the predictions and early detection of Diabetes Mellitus. Unfortunately, determining the most appropriate machine learning algorithm with the best performance in terms of optimum accuracy still remains a challenge. The study proposes a framework for Diabetes Mellitus detection using Machine Learning Algorithms. The proposed framework was evaluated using K-nearest neighbor (KNN), Random Forest (RF), and Logistic Regression (LR). Extensive experiments were conducted to analyze the performance of the framework focusing on four distinct different clinical datasets. To ensure robust, web compatible framework, Python and its popular data science related packages, Pandas, NumPy, Seaborn, Matplotlib and Pickle were used for the implementation. Significantly, using the standard datasets obtained from the National Institute of Diabetes and Kidney Disease, Random Forest was able to predict Diabetes Mellitus in the datasets with the best accuracy of 93.4 %.


Adeshina, A.M., Hashim, R., Khalid, N.E.A., Abidin ,S.Z.Z. (2012). Locating Abnormalities in Brain Blood Vessels using Parallel Computing Architecture. Interdiscip Sci Comput Life Sci 4,161–172.

Adeshina, A.M., Hashim, R., Khalid, N.E.A. (2014). CAHECA: Computer Aided Hepatocellular Carcinoma Therapy Planning. Interdiscip Sci Comput Life Sci 6, 222–234.

Adeshina, A.M., Hashim, R. (2015). ConnectViz: Accelerated Approach for Brain Structural Connectivity using Delaunay Triangulation. In: Interdisciplinary sciences: computational life sciences, pp 1–13.

Ballewar, A., Shukla, Y., Yumnam, R., Shihan, A., Mandawkar, U. (2021). Diabetes Prediction Using Machine Learning. International Journal of Scientific Research in Computer Science, Engineering and Information Technology (IJSRCSEIT), Volume 7(3), pp. 487-493.

Bhattacharya, M., Datta, D. (2023). Development of Predictive Models of Diabetes using Ensemble Machine Learning Classifier. Advancements in Smart Computing and Information Security: First International Conference, ASCIS 2022. Part 1, 377-388.

Dey, S.K., Hossain, A., Rahman, M.M. (2018). Implementation of a Web Application to Predict Diabetes Disease: An Approach Using Machine Learning Algorithm. 21st International Conference of Computer and Information Technology (ICCIT), 21- 23 December.

Fabian, M.E., Ferdinan, F.X., Sendani, G.P., Suryanigrum, K.M., Yunanda, R. (2023). Procedia Computer Science 216, 21-30.

Himi, S.T., Monalisa, N.T., Whaiduzzaman, M.,Barros, A., Uddin, M.S. (2023). MedAi: A Smartwatch-based Application Framework for Common Diseases Prediction using Machine Learning. IEEE Access, 2023.

Kowsher,M., Turaba, M.Y., Sajed, T., Rahman, M.M. (2019). Prognosis and Treatment Prediction of Type-2 Diabetes Using Deep Neural Network and Machine Learning Classifiers. 22nd International Conference on Computer and Information Technology (ICCIT).

Kulkarni, A.R., Patel, A.A., Pipal, K.V., Jaiswal, S.G., Jaisinghani, M.T., Thulkar, V., Gajbhiye, L., Gondane, P., Patel, A.B., Mamtani, M., Kulkarni, H. (2023). Machine-Learning Algorithm to Non-Invasively Detect Diabetes and Pre-Diabetes from Electrocardiogram. BMJ Innovations 9(1).

Sisodia, D., Sisodia, D.S. (2018). Prediction of diabetes using classification algorithms. Procedia computer science 132: 1578-1585.

Ullah, Z., Saleem, F., Jamjoom, M., Fakieh, B., Kateb, F., Ali, M.A., Shah., B. (2022). Detecting High-Risk Factors and Early Diagnosis of Diabetes using Machine Learning Methods. Computational Intelligence and Neuroscience 2022.

Warke, M., Kumar, V.,Tarale, S., Galgat, P., Chaudhari, D.J. (2019). Diabetes Diagnosis using Machine Learning Algorithms. International Research Journal of Engineering and Technology (IRJET). 6(3).

Wei, S., Zhao, X., Miao, C. (2018). A Comprehensive Exploration to the Machine Learning Techniques for Diabetes Identification. IEEE 4th World Forum on Internet of Things (WF-IoT).