Comparative Analysis of Naïve Bayes and K-Nearest Neighbors Algorithms in Predicting Public Interest in Electric Motorcycles - Syahputra, Arief; Zuhri Harahap, Syaiful; Nasution , Marnis (Publisher Cv. Inara, 2024)
Concerns about global warming and the need for sustainable transport solutions have led to the emergence of electric vehicles as an alternative to conventional vehicles. These vehicles offer cleaner and more efficient transportation, especially in urban areas. However, high costs in some countries, such as Indonesia, hinder their adoption. Electric motorcycle companies use previously recorded data to predict customer interest in purchasing their products. Based on these forecasts, business owners make decisions about the quantity of goods to supply. Researchers are increasingly using machine learning algorithms to study consumer behavior and predict demand for a variety of products, including electric motorcycles. The researchers have used this data-based method to analyze large amounts of consumer data, including online survey responses and reviews, as well as other sources. The study aims to perform a comparative analysis of the performance of the Naïve Bayes and K-Nearest Neighbors algorithms to predict public interest in electric motorcycles in Labuhanbatu district. We will perform a comparative analysis based on the performance evaluation matrix (accuracy, precision, recall, and f1 score) to determine the most suitable algorithm. The phases of the research methods included: data collection, exploratory data analysis, data preprocessing, splitting data, implementation of naïve bayes and k-nearest neighbors, and evaluation. The results showed that Naïve Bayes achieved an accuracy of 31.13%, precision of 83.33%, recall of 4.63%, and f1-score of 8.77%. In contrast, K-Nearest Neighbors attains an accuracy of 71.52% and a precision of 71.52%, recall 100%, and f1 score of 83,40%. According to the research results, K-nearest neighbors showed much better results in terms of accuracy, recall, and F1 scores. These results demonstrate that K-nearest neighbor is more effective in detecting public interest in electric motorcycles, and it strikes a better balance between identifying all positive cases and avoiding predictive errors.