Sentiment Analysis of ChatGPT Using the KNN Algorithm and K-Fold Cross-Validation Optimization of the K Value - Azliza Yacob; Nurzal Effiyana Ghazali; Faez M. Hassan (JICO: International Journal of Informatics and Computing, 2025)
ChatGPT is a cutting-edge artificial intelligence language model powered by advanced machine learning technologies, such as GPT-4.0. It’s remarkable ability to generate human-like text and engage in interactive conversations has captured widespread attention, particularly on social media. As a result, public sentiment toward ChatGPT has become a significant topic, necessitating detailed sentiment analysis to comprehend the broader societal reactions to this technology. This study focuses on optimizing the K value in sentiment analysis applied to Twitter data about ChatGPT. Selecting the appropriate K value is crucial, as improper values can result in overfitting or underfitting the model. The research methodology includes several stages: data collection, pre-processing, feature extraction, k-fold cross-validation for K optimization, implementing the K-Nearest Neighbors (KNN) algorithm, and evaluating results. The analysis determined that the optimal K value for this sentiment analysis is K=9. Using this value, the KNN algorithm achieved an accuracy of 88%, indicating robust performance in classifying sentiment effectively. These findings highlight the potential of this approach to provide meaningful insights into public perception and sentiment regarding ChatGPT on social media platforms. This result not only underscores the technical effectiveness of KNN for sentiment analysis but also demonstrates the practical application of machine learning in understanding societal trends in the context of emerging AI technologies.