Comparison of Grid Search and Random Search Effectiveness in Parameter Tuning on Electric Car Sentiment Analysis

https://doi.org/10.47194/ijgor.v6i2.371

Authors

  • Moch Panji Agung Saputra Department of Mathematics, Universitas padjadjaran
  • Muhammad Bintang Eighista Dwiputra

Keywords:

Electric car, sentiment analysis, xgboost classifier, random search, grid search, hyperparameter tuning

Abstract

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.

References

Aftab, F., Bazai, S. U., Marjan, S., Baloch, L., Aslam, S., Amphawan, A., & Neo, T. K. (2023). A comprehensive survey on sentiment analysis techniques. International Journal of Technology, 14(6), 1288-1298.

Belete, D. M., & Huchaiah, M. D. (2022). Grid search in hyperparameter optimization of machine learning models for prediction of HIV/AIDS test results. International Journal of Computers and Applications, 44(9), 875-886.

Havrlant, L., & Kreinovich, V. (2017). A simple probabilistic explanation of term frequency-inverse document frequency (tf-idf) heuristic (and variations motivated by this explanation). International Journal of General Systems, 46(1), 27-36.

Jamaleddyn, I., El Ayachi, R., & Biniz, M. (2023). Optimization of Machine Learning Algorithms Through Hyper-parameter Tuning Applied for the classification of Arabic news.

Obi, J. C. (2023). A comparative study of several classification metrics and their performances on data. World Journal of Advanced Engineering Technology and Sciences, 8(1), 308-314.

Pipin, S. J., Sinaga, F. M., Winardi, S., & Hakim, M. N. (2023). Sentiment Analysis Classification of ChatGPT on Twitter Big Data in Indonesia Using Fast R-CNN. J. MEDIA Inform. BUDIDARMA, 4, 2137-2148.

Soltanzadeh, P., & Hashemzadeh, M. (2021). RCSMOTE: Range-Controlled synthetic minority over-sampling technique for handling the class imbalance problem. Information Sciences, 542, 92-111.

Suandi, F., Anam, M. K., Firdaus, M. B., Fadli, S., Lathifah, L., Yumami, E., ... & Hasibuan, A. Z. (2024, December). Enhancing Sentiment Analysis Performance Using SMOTE and Majority Voting in Machine Learning Algorithms. In 7th International Conference on Applied Engineering (ICAE 2024) (pp. 126-138). Atlantis Press.

Wijaya, H., Hostiadi, D. P., & Triandini, E. (2024). Optimization of XGBoost Algorithm Using Parameter Tunning in Retail Sales Prediction. Jurnal Nasional Pendidikan Teknik Informatika: JANAPATI, 13(3), 769-786.

Published

2025-06-05