Evaluation of Various Error Metrics in K-NN Image Classification: A Case Study on Egg Image Processing

Authors

  • Frainskoy Rio Naibaho IAKN Tarutung
  • Al- Khowarizmi Universitas Muhammadiyah Sumatera Utara

DOI:

https://doi.org/10.31154/cogito.v11i1.859.91-100

Keywords:

Image processing, Measurement Accuracy, Classification, K-NN, Various Error Metrics

Abstract

Image processing is a technique to create an image that appears and can be converted into light that describes 2 dimensions. The K-Nearest Neighbor (K-NN) algorithm is known for its efficiency and effectiveness in classification. Although K-NN is often used, a deep understanding of Mean Squared Error (MSE), Mean Absolute Percentage Error (MAPE), and Mean Absolute Deviation (MAD) especially in the context of image classification, still requires further exploration. This study aims to emphasize and measure the behavior of MSE, MAPE, and MAD when applied to K-NN classification results. In this study, calculating statistical features such as mean, standard deviation, skewness, and kurtosis are extracted from the histogram of chicken egg images. These features are then normalized and used as input for the K-NN algorithm. Classification performance is evaluated using MSE, MAPE, and MAD. The results show that K-NN is able to classify chicken egg images with performance measured by MSE of 0.35114462, MAPE of 0.14237803%, and MAD of 0.52930142. The differences in these values, especially the much smaller MAPE value and in percentage units, underscore the importance of selecting the right metrics according to the needs of interpretation and practical applications. This study provides a clearer understanding of how different error metrics characterize the performance of K-NN in image classification, while also highlighting the need for comparative metric considerations in future research.

References

F. R. Naibaho, “Optimizing the Division of Study Class Groups Using the Partitioning Around Medoids (PAM) Method,” JURNAL MEDIA INFORMATIKA BUDIDARMA, vol. 5, no. 1, p. 42, Jan. 2021, doi: 10.30865/mib.v5i1.2523.

F. R. Naibaho, “The Implementation of Multi-Objective Optimization Based on Ratio Analysis Method to Determine KIP Participants,” Journal of Computer Science, Information Technology and Telecommunication Engineering, Sep. 2020, doi: 10.30596/jcositte.v1i2.5080.

F. R. Naibaho, “Comparison between SAW and WASPAS Methods in Determining the Location of the Transit Warehouse of PT. TG,” JOURNAL OF INFORMATICS AND TELECOMMUNICATION ENGINEERING, vol. 4, no. 2, pp. 393–403, Jan. 2021, doi: 10.31289/jite.v4i2.4561.

F. R. Naibaho, “FUZZY LOGIC METODE TSUKAMOTO UNTUK PREDIKSI PRODUKSI CPO DENGAN PERMINTAAN BERSIFAT STOKASTIK PADA PT. TOR GANDA,” KOMIK (Konferensi Nasional Teknologi Informasi dan Komputer), vol. 3, no. 1, Nov. 2019, doi: 10.30865/komik.v3i1.1607.

M. Chen, F. Herrera, and K. Hwang, “Cognitive Computing: Architecture, Technologies and Intelligent Applications,” IEEE Access, vol. 6, pp. 19774–19783, 2018, doi: 10.1109/ACCESS.2018.2791469.

A. A. M. Al-Saffar, H. Tao, and M. A. Talab, “Review of deep convolution neural network in image classification,” in 2017 International Conference on Radar, Antenna, Microwave, Electronics, and Telecommunications (ICRAMET), IEEE, Oct. 2017, pp. 26–31. doi: 10.1109/ICRAMET.2017.8253139.

A. Maier, C. Syben, T. Lasser, and C. Riess, “A gentle introduction to deep learning in medical image processing,” Z Med Phys, vol. 29, no. 2, pp. 86–101, May 2019, doi: 10.1016/j.zemedi.2018.12.003.

O. S. Sitompul, Z. Situmorang, F. R. Naibaho, and E. B. Nababan, “Steganography with Highly Random Linear Congruential Generator for Security Enhancement,” in 2018 Third International Conference on Informatics and Computing (ICIC), IEEE, Oct. 2018, pp. 1–6. doi: 10.1109/IAC.2018.8780445.

Z. Han and A. Xu, “RETRACTED: Ecological evolution path of smart education platform based on deep learning and image detection,” Microprocess Microsyst, vol. 80, p. 103343, Feb. 2021, doi: 10.1016/j.micpro.2020.103343.

A.-K. Al-Khowarizmi and S. Suherman, “Classification of skin cancer images by applying simple evolving connectionist system,” IAES International Journal of Artificial Intelligence (IJ-AI), vol. 10, no. 2, p. 421, Jun. 2021, doi: 10.11591/ijai.v10.i2.pp421-429.

V. Y. Reddy, Adimoolam, and I. Sudha, “Comparison of accuracy on K-nearest neighbor and random forest algorithm based brain tumor detection in MRI images,” 2023, p. 020043. doi: 10.1063/5.0173997.

J. Nababan, S. A. Pasaribu, F. R. Naibaho, E. M. Theodora, E. M. Theodora, and N. Banuari, “Penerapan Augmented Reality Dalam Pengenalan Buah-Buahan Sebagai Media Pembelajaran Pada Sekolah Dasar Kartini Medan,” Jurnal Minfo Polgan, vol. 13, no. 1, pp. 570–578, Jun. 2024, doi: 10.33395/jmp.v13i1.13732.

S. Suherman, F. Fahmi, Z. Herry, M. Al-Akaidi, and Al-Khowarizmi, “Sensor Based versus Server Based Image Detection Sensor using the 433 Mhz Radio Link,” in 2020 4rd International Conference on Electrical, Telecommunication and Computer Engineering (ELTICOM), IEEE, Sep. 2020, pp. 7–10. doi: 10.1109/ELTICOM50775.2020.9230502.

A. R. Lubis, S. Prayudani, M. Lubis, and A. Khowarizmi, “Decision Making in the Tea Leaves Diseases Detection Using Mamdani Fuzzy Inference Method,” Indonesian Journal of Electrical Engineering and Computer Science, vol. 12, no. 3, p. 1273, Dec. 2018, doi: 10.11591/ijeecs.v12.i3.pp1273-1281.

C. Hartmann and M. Siegrist, “Consumer perception and behaviour regarding sustainable protein consumption: A systematic review,” Trends Food Sci Technol, vol. 61, pp. 11–25, Mar. 2017, doi: 10.1016/j.tifs.2016.12.006.

M. S. Islam, M. M. Hasan, X. Wang, H. D. Germack, and M. Noor-E-Alam, “A Systematic Review on Healthcare Analytics: Application and Theoretical Perspective of Data Mining,” Healthcare, vol. 6, no. 2, p. 54, May 2018, doi: 10.3390/healthcare6020054.

L. Farokhah, “Implementasi K-Nearest Neighbor untuk Klasifikasi Bunga Dengan Ekstraksi Fitur Warna RGB,” Jurnal Teknologi Informasi dan Ilmu Komputer, vol. 7, no. 6, pp. 1129–1136, Dec. 2020, doi: 10.25126/jtiik.2020722608.

A. Muzami, O. D. Nurhayati, and K. T. Martono, “Aplikasi Identifikasi Citra Telur Ayam Omega-3 Dengan Metode Segmentasi Region Of Interest Berbasis Android,” Jurnal Teknologi dan Sistem Komputer, vol. 4, no. 2, p. 380, Apr. 2016, doi: 10.14710/jtsiskom.4.2.2016.380-388.

J. Dong et al., “Prediction of infertile chicken eggs before hatching by the Naïve-Bayes method combined with visible near infrared transmission spectroscopy,” Spectroscopy Letters, vol. 53, no. 5, pp. 327–336, May 2020, doi: 10.1080/00387010.2020.1748061.

H. Maeda, Y. Sekimoto, T. Seto, T. Kashiyama, and H. Omata, “Road Damage Detection and Classification Using Deep Neural Networks with Smartphone Images,” Computer-Aided Civil and Infrastructure Engineering, vol. 33, no. 12, pp. 1127–1141, Dec. 2018, doi: 10.1111/mice.12387.

T. Iliou and C.-N. Anagnostopoulos, “SVM-MLP-PNN Classifiers on Speech Emotion Recognition Field - A Comparative Study,” in 2010 Fifth International Conference on Digital Telecommunications, IEEE, Jun. 2010, pp. 1–6. doi: 10.1109/ICDT.2010.8.

P. Thanh Noi and M. Kappas, “Comparison of Random Forest, k-Nearest Neighbor, and Support Vector Machine Classifiers for Land Cover Classification Using Sentinel-2 Imagery,” Sensors, vol. 18, no. 1, p. 18, Dec. 2017, doi: 10.3390/s18010018.

A. Y. Shdefat, N. Mostafa, Z. Al-Arnaout, Y. Kotb, and S. Alabed, “Optimizing HAR Systems: Comparative Analysis of Enhanced SVM and k-NN Classifiers,” International Journal of Computational Intelligence Systems, vol. 17, no. 1, p. 150, Jun. 2024, doi: 10.1007/s44196-024-00554-0.

Al-Khowarizmi, Akrim, M. Lubis, and A. R. Lubis, “Classification of Tajweed Al-Qur’an on Images Applied Varying Normalized Distance Formulas,” in Proceedings of the 3rd International Conference on Electronics, Communications and Control Engineering, New York, NY, USA: ACM, Apr. 2020, pp. 21–25. doi: 10.1145/3396730.3396739.

S. Prayudani, A. Hizriadi, Y. Y. Lase, Y. Fatmi, and Al-Khowarizmi, “Analysis Accuracy Of Forecasting Measurement Technique On Random K-Nearest Neighbor (RKNN) Using MAPE And MSE,” J Phys Conf Ser, vol. 1361, no. 1, p. 012089, Nov. 2019, doi: 10.1088/1742-6596/1361/1/012089.

S. Uddin, I. Haque, H. Lu, M. A. Moni, and E. Gide, “Comparative performance analysis of K-nearest neighbour (KNN) algorithm and its different variants for disease prediction,” Sci Rep, vol. 12, no. 1, p. 6256, Apr. 2022, doi: 10.1038/s41598-022-10358-x.

Z. Fan, J. Xie, Z. Wang, P.-C. Liu, S. Qu, and L. Huo, “Image Classification Method Based on Improved KNN Algorithm,” J Phys Conf Ser, vol. 1930, no. 1, p. 012009, May 2021, doi: 10.1088/1742-6596/1930/1/012009.

A. Ridho Lubis, S. Prayudani, and Al-Khowarizmi, “Optimization of MSE Accuracy Value Measurement Applying False Alarm Rate in Forecasting on Fuzzy Time Series based on Percentage Change,” in 2020 8th International Conference on Cyber and IT Service Management (CITSM), IEEE, Oct. 2020, pp. 1–5. doi: 10.1109/CITSM50537.2020.9268906.

P. Hait, A. Sil, and S. Choudhury, “Seismic damage assessment and prediction using artificial neural network of RC building considering irregularities,” Journal of Structural Integrity and Maintenance, vol. 5, no. 1, pp. 51–69, Jan. 2020, doi: 10.1080/24705314.2019.1692167.

S. A. Hosseini, A. Abbaszadeh Shahri, and R. Asheghi, “Prediction of bedload transport rate using a block combined network structure,” Hydrological Sciences Journal, vol. 67, no. 1, pp. 117–128, Jan. 2022, doi: 10.1080/02626667.2021.2003367.

L. Blecher and R. J. Yeh, “Forecasting Meal Participation in University Residential Dining Facilities,” Journal of Foodservice Business Research, vol. 11, no. 4, pp. 352–362, Dec. 2008, doi: 10.1080/15378020802519637.

G. Müller-Plath and H.-J. Lüdecke, “Normalized coefficients of prediction accuracy for comparative forecast verification and modeling,” Research in Statistics, vol. 2, no. 1, Dec. 2024, doi: 10.1080/27684520.2024.2317172.

A. Khowarizmi, R. Syah, M. K. M. Nasution, and M. Elveny, “Sensitivity of MAPE using detection rate for big data forecasting crude palm oil on k-nearest neighbor,” International Journal of Electrical and Computer Engineering (IJECE), vol. 11, no. 3, p. 2696, Jun. 2021, doi: 10.11591/ijece.v11i3.pp2696-2703.

W.-C. Chao and E. M. Wang, “Using the finger cun of acupuncture-point location as benchmark to estimate body dimensions,” Journal of the Chinese Institute of Industrial Engineers, vol. 27, no. 2, pp. 121–131, Mar. 2010, doi: 10.1080/10170660903528994.

A. Belaadi, M. Boumaaza, H. Alshahrani, and M. Bourchak, “Optimization of Palm Rachis Biochar Waste Content and Temperature Effects on Predicting Bio-Mortar : ANN and RSM Modelling,” Journal of Natural Fibers, vol. 20, no. 1, Apr. 2023, doi: 10.1080/15440478.2022.2151547.

W.-J. Chen, J.-J. Yao, and Y.-H. Shao, “Volatility forecasting using deep neural network with time-series feature embedding,” Economic Research-Ekonomska Istraživanja, vol. 36, no. 1, pp. 1377–1401, Mar. 2023, doi: 10.1080/1331677X.2022.2089192.

M. Ghiassi and S. Nangoy, “A dynamic artificial neural network model for forecasting nonlinear processes,” Comput Ind Eng, vol. 57, no. 1, pp. 287–297, Aug. 2009, doi: 10.1016/j.cie.2008.11.027.

I. Veza, M. F. Roslan, M. F. Muhamad Said, Z. Abdul Latiff, and M. A. Abas, “Cetane index prediction of ABE-diesel blends using empirical and artificial neural network models,” Energy Sources, Part A: Recovery, Utilization, and Environmental Effects, vol. 46, no. 1, pp. 16025–16042, Dec. 2024, doi: 10.1080/15567036.2020.1814906.

Downloads

Published

2025-06-30

How to Cite

Naibaho, F. R., & Khowarizmi, A.-. (2025). Evaluation of Various Error Metrics in K-NN Image Classification: A Case Study on Egg Image Processing. CogITo Smart Journal, 11(1), 91–100. https://doi.org/10.31154/cogito.v11i1.859.91-100