The increasing use of electric cars in Indonesia has prompted many public discussions recorded on various digital platforms. This study aims to classify public sentiment towards the implementation of electric cars through comment analysis using the XGBoost Classifier model. The data used were obtained from the Kaggle platform, in the form of public comments that have gone through pre-processing stages, such as removing empty data, label encoding, and visualizing class distribution. Furthermore, the data was divided into training, validation, and test data using stratification techniques, and data imbalance was handled using the SMOTE method. Modeling was carried out using the XGBoost Classifier algorithm, then hyperparameter tuning was carried out using two approaches, namely Random Search and Grid Search. The parameters tested included learning_rate, max_depth, n_estimators, subsample, colsample_bytree, gamma, alpha, and lambda. The experimental results showed that the model without tuning produced an accuracy of 67%. After tuning, Random Search increased its accuracy to 68%, while Grid Search achieved the highest accuracy of 69%. Based on evaluation using precision, recall, f1-score, and accuracy metrics, tuning with Grid Search is proven to provide more optimal results compared to other methods. This study shows that systematic hyperparameter tuning can improve the performance of sentiment classification models.
Copyrights © 2025