Analisis Sentimen Twitter Pengaruh Tokoh Politik dengan Menggunakan Metode K-Nearest Neighbor

  • I Made Surya Adi Palguna Universitas Udayana
  • Ngurah Agus Sanjaya ER Universitas Udayana


Understanding public sentiment towards political figures is crucial for gauging their influence and impact. This study employs sentiment analysis to analyze Twitter data and assess the influence of political figures. Sentiment analysis, a computational exploration of expressed opinions, emotions, and sentience, allows insights into public perception on a large scale. This work leverages the K-Nearest Neighbor (KNN) algorithm, which classifies data based on its similarity to existing data points. Tweets undergo preprocessing, followed by TF-IDF weighting for keyword importance and cosine similarity calculations for comparing tweets to a labeled training dataset. By analyzing the nearest neighbors, sentiment values are assigned. The KNN model achieved an accuracy of 89%, a precision of 85%, and a recall of 88%, demonstrating its effectiveness in assessing sentiment and influence through Twitter data. This research contributes to the field of political communication by offering a robust method for analyzing public opinion and gauging the influence of political figures on social media platforms.

Keywords: Sentiment Analysis, K-Nearest Neighbor, TF-IDF, Cosine Similarity

How to Cite
PALGUNA, I Made Surya Adi; SANJAYA ER, Ngurah Agus. Analisis Sentimen Twitter Pengaruh Tokoh Politik dengan Menggunakan Metode K-Nearest Neighbor. Jurnal Nasional Teknologi Informasi dan Aplikasnya, [S.l.], v. 2, n. 2, p. 443-448, jan. 2024. ISSN 3032-1948. Available at: <>. Date accessed: 21 feb. 2024.

Most read articles by the same author(s)

Obs.: This plugin requires at least one statistics/report plugin to be enabled. If your statistics plugins provide more than one metric then please also select a main metric on the admin's site settings page and/or on the journal manager's settings pages.