Twitter is one of the social media used by the public to convey their views regarding the government's policy of issuing a Government Regulations in Lieu of Laws (Bahasa: Peraturan Pemerintah Pengganti Undang-undang (Perpu)). The public's pros and cons of this policy are material for sentiment analysis. The purpose of this study was to analyze Twitter users' opinions regarding the Job Creation Perpu using the K-Nearest Neighbors (KNN), Random Forest (RF), and Particle Swarm Optimization (PSO) methods. The data was 3.128 tweets from Twitter social media users regarding the Government Regulation in Lieu of Law on Job Creation. Based on 3.128 data, 1.599 sentiments were positive, 1.473 sentiments were negative and 53 sentiments were neutral. The results showed that PSO feature optimized Twitter social media sentiment analysis against this regulation. KNN and RF algorithms for sentiment analysis was carried out before and after optimization with PSO. Experimental results using RapidMiner 9.10 showed that PSO feature succeeded in increasing classification accuracy in both algorithms. Before optimization, the KNN accuracy value reached 80.40%, then increased significantly to 85.23% after optimization with PSO was applied. Meanwhile, Random Forest accuracy value before optimization was 77.21% and increased to 80.53% after PSO was applied. This result indicated that the PSO-based KNN algorithm had better performance in conducting sentiment analysis of the Government Regulation in Lieu of Law on Job Creation on Twitter compared to the Random Forest algorithm in the context of this study. It concluded that Random Forest algorithm based on PSO is the best classifier for sentiment analysis and a potential and effective algorithm for classifying and analyzing sentiment on the same topic.