Customer loyalty is a crucial element in maintaining business continuity in today’s competitive digital era. This study aims to classify customer loyalty levels based on sales and transaction behavior data using two supervised machine learning algorithms: K-Nearest Neighbor (KNN) and Decision Tree. The models were developed and evaluated using Python in the Google Colaboratory environment, utilizing a dataset of 250 customer records. The research process included data preprocessing, feature selection, normalization, data splitting, model building, and evaluation using accuracy, precision, recall, and F1-score metrics. Evaluation results showed that the Decision Tree algorithm delivered the best performance with 99.20% accuracy, 99.50% precision, 99.50% recall, and a 99.50% F1-score. Meanwhile, the KNN algorithm achieved 91.60% accuracy, 91.63% precision, 98.50% recall, and a 94.91% F1-score. These findings indicate that the Decision Tree model is more effective for classifying customer loyalty and can be implemented as a decision support tool for data-driven Customer Relationship Management (CRM) strategies.
Copyrights © 2025