Abstract
Toxic (hateful and rude) behaviour is a huge problem in social media websites since toxic comments prevent constructive discussions and discourage people from starting conversations. Since millions of comments are posted daily, there needs to be some automated way to identify comments that are toxic and take action accordingly. In this paper, we aim to create a deep neural network that uses word embeddings for feature extraction and classifies comments into two classes—“Toxic” and “Non-toxic”. We have used a single recurrent layer, either LSTM, GRU, Bi-LSTM or Bi-GRU, in combination with other layers in our deep neural network to determine which architecture best suits this application. To handle class imbalance, we have used random under sampling on the majority class and data augmentation on the minority class. Our model was tested on Wikipedia Comments and Twitter Hate Comments datasets and achieved F1 scores of 0.89 and 0.84, respectively, outperforming the other works in this domain.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Similar content being viewed by others
References
Davidson T, Warmsley D, Macy M, Weber I (2017) Automated hate speech detection and the problem of offensive language. In: Proceedings of the International AAAI conference on web and social media, vol 11(1). The AAAI Press, Palo Alto, California, pp 512–515
Yin D, Xue Z, Hong L, Davison BD, Kontostathis A, Edwards L (2009) Detection of harassment on web 2.0. Proc Content Anal WEB 2:1–7
Zaheri S, Leath J, Stroud D (2020) Toxic comment classification. SMU Data Sci Rev 3(1)
Nguyen H, Nguyen ML (2017) A deep neural architecture for sentence-level sentiment classification in Twitter social networking. In: Hasida K, Pa W (eds) International conference of the Pacific association for computational linguistics. Springer, Singapore, pp 15–27
Beniwal R, Maurya A (2021) Toxic comment classification using hybrid deep learning model. In: Karuppusamy P, Perikos I, Shi F, Nguyen TN (eds) Sustainable communication networks and application. Springer, Singapore, pp 461–473
Yu LC, Wang J, Lai KR, Zhang X (2017) Refining word embeddings for sentiment analysis. In: Proceedings of conference on empirical methods in natural language processing. Copenhagen, Denmark, pp 534–539
Chu T, Jue K, Wang M (2017) Comment abuse classification with deep learning. http://web.stanford.edu/class/archive/cs/cs224n/cs224n.1174/reports/2762092.pdf. Accessed 12 Jun 2021
Khieu K, Narwal N (2018) Detecting and classifying toxic comments. https://web.stanford.edu/class/archive/cs/cs224n/cs224n.1184/reports/6837517.pdf. Accessed 12 Jun 2021
Van Aken B, Risch J, Krestel R, Löser A (2018) Challenges for toxic comment classification: an in-depth error analysis. arXiv preprint arXiv:1809.07572
Pennington J, Socher R, Manning CD (2014) Glove: Global vectors for word representation. In: Proceedings of the 2014 conference on empirical methods in natural language processing (EMNLP), pp 1532–1543
Cho K, Van Merriënboer B, Gulcehre C, Bahdanau D, Bougares F, Schwenk H, Bengio Y (2014) Learning phrase representations using RNN encoder-decoder for statistical machine translation. arXiv preprint arXiv:1406.1078
Keskar NS, Mudigere D, Nocedal J, Smelyanskiy M, Tang PT (2016) On large-batch training for deep learning: generalization gap and sharp minima. arXiv preprint arXiv:1609.04836
Author information
Authors and Affiliations
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 2022 The Author(s), under exclusive license to Springer Nature Singapore Pte Ltd.
About this paper
Cite this paper
Saxena, A., Mittal, A., Verma, R. (2022). Binary Classification of Toxic Comments on Imbalanced Datasets Using Recurrent Neural Networks. In: Agrawal, S., Gupta, K.K., Chan, J.H., Agrawal, J., Gupta, M. (eds) Machine Intelligence and Smart Systems. Algorithms for Intelligent Systems. Springer, Singapore. https://doi.org/10.1007/978-981-16-9650-3_27
Download citation
DOI: https://doi.org/10.1007/978-981-16-9650-3_27
Published:
Publisher Name: Springer, Singapore
Print ISBN: 978-981-16-9649-7
Online ISBN: 978-981-16-9650-3
eBook Packages: Intelligent Technologies and RoboticsIntelligent Technologies and Robotics (R0)