Chavan 2015
Chavan 2015
Abstract—The fast growing use of social networking sites used for experiments are collected from kaggle website [8].
among the teens have made them vulnerable to get exposed to The training datasets contain just 4000 comments. The
bullying. Cyberbullying is the use of computers and mobiles model is applied on the test set which contains close to 2500
for bullying activities. Comments containing abusive words comments. The first objective is to predict whether a
effect psychology of teens and demoralizes them. In this paper comment is an insult to a participant of a conversations. We
we have devised methods to detect cyberbullying using have proposed two new hypotheses for detecting
supervised learning techniques. We present two new cyberbullying. Further a comparison between the
hypotheses for feature extraction to detect offensive comments performances of popular machine learning classification
directed towards peers which are perceived more negatively
algorithms is presented.
and result in cyberbullying. Our initial experiments show that
using features from our hypotheses in addition to traditional This problem is a binary classification problem where
feature extraction techniques like TF-IDF and N-gram we are trying to classify comments as bullying and non-
increases the accuracy of the system. bullying. We have identified features which detect offensive
comments directed towards peers in addition to standard
Keywords—cyber-aggressive; supervised; machine learning;
features extraction techniques such as TF-IDF score, N-
I. INTRODUCTION grams, bad word count and stemming to model Supervised
Cyberbullying is a kind of online harassment, which can machine learning algorithms like Support vector machines
be defined as rude, insulting, offensive, teasing, and Logistic regression. The feature vector built using
demoralizing comments through online social media proposed features effectively detects the comments directed
targeting one's educational qualifications, gender, family and towards peers as bullied.
personal habits. According to ‘Tweens, Teens and The rest of the paper is organized as follows. Section II
Technology 2014 Report' by McAfee[7], 50% of Indian describes the related work carried out in this field. In section
Youth have had some experience with cyberbullying. III we describe the proposed method. Section IV contains the
According to a survey [10], it has been identified that a results. Finally in section V we present the future scope.
significant number of suicides have been committed by teens
who were exposed to cyberbullying. Teens feel demoralized II. RELATED WORK
and get frustrated when they encounter such cyber- In an effort to model the cyberbullying, Kelly Reynolds and
aggressive comments which act as a barrier for participation April Kontosthatis, 2011[1] used machine learning to train
and socializing. Most networking sites today prohibit the use the data collected from FromSpring.me, a social networking
of offensive and insulting comments. But this partially being site, the data was labeled using Amazon Web service called
carried out and filtered to a limited extent. As there is Turk. The number of bad words were used as a feature to
enormous amount of data available it is impossible to take train model. In a study by Dinakar et al [2], states that
help of human moderators to manually flag each insulting individual topic-sensitive classifiers are more effective to
and offensive comments. Thus, a automatic classifiers that is
detect cyberbullying. They experimented on a large corpus
fast and effective to detect such type of comments is required
which will further reduce cyberbullying. However, there are of comments collected from Youtube.com website. Ellen
enormous challenges involved as comments contains many Spertus [3] tried to detect the insult present in comments,
special characters eg:”Your a retard go post your head up they used static dictionary approach and defined some
your #%&*”,”U r !diot” containing insults and also some patterns on socio-linguistic observation to build feature
sarcastic comments. In this paper we use machine learning vector which had a disadvantage of high false positive rate
techniques to detect the insults and offensiveness of the and low coverage rate. Altaf Mahmud et al [4] tried to
comments present in social networking sites. The datasets differentiate between factual and insult statements by parsing
978-1-4799-8792-4/15/$31.00 2015
c IEEE 2354
comments using semantic rules, but they did not concentrate which contains many unwanted strings like '\xa0','\\n'
on comments directed towards participants and non- and many such encoding parts should be removed.
participants. Another work by Razavi et al [5] used a static Hence the first step is to preprocess the comments
dictionary and three level classification approach using bag- by removing unwanted strings,hyphens and
of-words features, which involved use of dictionary that is punctuations. The following figure demonstrates an
not easily available. example of this step.
All these methods lack generality due to flexible use in
conversation and uses rule-based recognition which is
difficult to model. These work do not distinguish between
the offensive comments directed towards the people
participating in blog/forum conversation and non-
participants such as celebrities, public figures etc.
We aim at building an efficient classifier on proposed
features to detect cyberbullying comments directed towards
peers participating in conversations over social media. Fig. 2: Removing unwanted strings
• Correcting words: One of the reasons comments are
III. PROPOSED METHOD classified as insulting is the presence of profane or
This section proposes the methodology and framework abusive words. The total number of bad words
used for classification of comments. Diagrammatically it is present in comments is taken as one of the features.
shown in fig 1. The steps involved are Normalization, A dictionary of 500 bad words [9] is compiled,
standard Feature extraction, additional feature extraction, which also includes variations of words (@$$ ,s h i
feature selection and finally classification. t). This dictionary is used because people using the
online forums sometimes use special characters to
build a insulting word (!d!ot,@$$ole). When we
encounter such words, the dictionary helps to
convert them into natural form. Also, Stemming is
applied to capture bad word variations that are not
contained in dictionary. Stemming reduces a word to
its core root, for example embarrassing is reduced to
embarrass. Here it is noted that stemming is only
applied to bad word dictionary not on the dataset
used, as it will lead to information loss. Again a
small dictionary and a spell checker is used to
convert all variations of “you”, ”you’re” (e.g u, ur
etc) which are present in the dataset as participant
use them as part of flexible language. Following
figure demonstrates an example of this step.
2015 International Conference on Advances in Computing, Communications and Informatics (ICACCI) 2355
are”, “are funny you”. We use 2, 3, 4 and 5 N-grams • Skip- grams: We also used skip-grams in building a
for the building feature vector. feature vector as they help in detecting insult more
• Counting: Count the number of times each of these effectively. These consider the long distance words
tokens occurs in each of the text strings. This way as a feature. For example consider “You are an
we construct a sparse matrix of size N by V where N idiot” as a comment, if we use 2-skip-gram, count
is the size of the training data which is number of of 'You are' as one feature and 'an idiot' as other is
comments and V is the size of the vocabulary, the added in our feature-matrix. This way, the
length of feature vector constructed over the whole comments containing co-occurrences of words like
training set using n-grams, skip grams and use of “You idiots” which is negative and will be detected
pronouns representing all the text strings where the using skip-grams.
number of occurrences of each token is a feature for
that text string.
• TF-IDF Score: TF-IDF stands for "Term Frequency, TABLE I. FEATURES SETS
Inverse Document Frequency". It is a way to Features Description
evaluate the importance of words (or "terms") in a
N-gram Used unigram, bigram and trigram as binary
document based on how frequently they appear features
across various documents. The score signifies the
importance of that term in relation to the original Count Tokenized the comments and count the
occurrence of each token in it. This way we
training data. created a sparse matrix of NxV.
TF-IDF score is given by:
TF-IDF score Used to calculate the importance of words in
TF-IDF = tfij * idfi documents based on how frequently they are
Numerically, term frequency tfij specify the importance of a used
word i in comment j. It is determined as: Occurrence of pronouns This is additional feature which helps in
ܰ detecting cyber-aggressive comments based on
݂ݐ ൌ pronoun “You”.
ߑܰ
Skip-grams Adds a long distance words as a feature. Used to
detect co-occurrences of some words like “You
Where ܰ is the frequency of word i in comment j and idiot”.
ߑܰ is the frequency of all words in comment j.
Inverse document frequency idfi specifies the importance of
a word i in the entire training dataset. It is determined as: D. Feature Selection
ȁܥȁ
݂݅݀ ൌ
ȁܥ ǣ ܹ ߳ܥ ȁ The machine learning algorithms cannot handle all the
features which are order of some hundred thousand. So we
Where |C| is the total number of comments, ȁܥ ǣ ܹ ߳ܥ | is need to select best features out of our set of features. We use
the number of comments where word Wi appears. So each a statistical hypotheses method known as “Chi Squared test”
comment contains a vector of words and each word is to our feature matrix to select k best features where k is
denoted in the vector by its TF-IDF score. parameter roughly equal to 3000.
C. Additional Features
• Capturing pronouns: It is been observed that cyber- 1. Chi-Square Method: chi square (X2) method is
aggressive comments which are directed towards commonly used for selecting best features. This
peers are perceived more negatively and results in metric calculates the cost of a feature using the
cyberbullying [11]. Comments containing a value of the chi-squared statistics with respect to
pronoun like 'you' followed by a insulting or class. Initially, a hypothesis H0 is assumed that the
profane words are peer directed comments which two features are unrelated, and it is The initial
are taken as negative and teens get frustrated after hypothesis H0 is the assumption that the two
encountering such comments. So, to detect such features are unrelated, and it is tested by chi squared
comments we have used the count of pronouns as formula as is shown in equation (1)
ఀሺைೕ ିாೕ ሻ
one of the features for detecting cyberbullying. To ܺଶ ൌ (1)
ாೕ
extract this feature we calculate TF-IDF score of
pronoun present in comment. This feature is our Where Oij is the observed frequency and Eij is the expected
strong hypothesis which greatly increases the frequency, asserted by the null hypothesis. Higher the value
accuracy and helps in detecting cyber-aggressive of (X2), greater the evidence against the hypothesis H0,
comments. hence more related is the two variables. Lesser the value of
(X2), the hypotheses tends to be true, the variables are
independent.
2356 2015 International Conference on Advances in Computing, Communications and Informatics (ICACCI)
2. To understand this measure better consider the Whereܲ is the probability at observation i. Here Ԧ is
following example. calculated as:
ெ
2015 International Conference on Advances in Computing, Communications and Informatics (ICACCI) 2357
the corresponding set of labels in ground truth
(correct) labels.
C. Analysis
At first we build feature vector containing standard feature
extraction containing TF-IDF and N-grams. Then we train TABLE IV. PERFORMANCE OF MODEL WITH
our algorithms based on these feature vector and the best DIFFERENT SKIP- GRAMS
accuracy achieved is of logistic regression of 83%. Then, Skips AUC score Recall Precision
we include occurrence of pronouns and skip-gram as 86.84
features which increased the accuracy and logistic 2 skips 0.72 0.765
regression outperformed in this too with 86%. The test 3 skips 86.84 0.71 64.64
datasets used for our experiment contained nearly 3000
2,3 skips 86.92 0.71 0.769
unlabeled comments. Also, we tried to train the system with
all features using SVM and logistic regression. An
experimental result shown in Table II suggests that
comments targeted towards peers helps in detecting V. CONCLUSION AND FUTURE WORK
cyberbullying more efficiently. Table III shows the
In this paper, we presented two new hypothesis for feature
performance of algorithms trained on the standard features
extraction which can be helpful in detecting cyberbullying.
extraction techniques. Table IV shows the accuracy (AUC
We built a model which predicted comments as bully/non-
score), precision and recall values after introducing skip-
bully. The end result is probability of comment being
grams and pronouns as features. Following figure 4 shows
offensive to participants. Results show that our hypothesis
the increase in accuracy by introducing additional features
increases the accuracy by 4% and can be used to detect the
in addition to traditional features.
comments that are targeted towards peers.
88 Future work should be directed towards detecting
87 sarcastic comments.
86
REFERENCES
AUC score(%)
Traditional
85
Features [1] Reynolds, K.; Kontostathis, A.; Edwards, L., "Using Machine
84 Learning to Detect Cyberbullying," Machine Learning and
Occurence of
83 Pronoun
Applications and Workshops (ICMLA), 2011 10th International
Conference on, vol.2, no.,pp.241,244,18-21Dec.2011.
82
Skip Grams
81 [2] K. Dinakar, R. Reichart, and H. Lieberman, "Modeling the Detection
80 of Textual Cyberbullying," in Proc. IEEE International Fifth
International AAAI Conference on Weblogs and Social Media,
Features Barcelona, Spain, 2011.
Fig. 4: Increase in AUC score by adding additional features [3] Spertus, E., Smokey: Automatic recognition of hostile messages. In:
Proceedings of the Ninth Conference on Innovative Applications of
TABLE II. COMPARISON OF USING DIFFERENT Artificial Intelligence, pp. 1058–1065 (1997)
FEATURES [4] Mahmud, A., Ahmed, K.Z., Khan, M, Detecting flames and insults in
text. In: Proceedings of the Sixth International Conference on Natural
Features AUC Score Language Processing (2008)
Standard features extraction 82.69 [5] Razavi, A.H., Inkpen, D., Uritsky, S., Matwin, S., Offensive language
detection using multi- level classification. In: Proceedings of the 23rd
Occurrence of pronouns 86.58 Canadian Conference on Artificial Intelligence, pp. 16–27 (2010)
Skip grams 86.87 [6] Xiang, G., Hong, J., & Rosé, C. P. , Detecting Offensive Tweets via
Topical Feature Discovery over a Large Scale Twitter Corpus,
Proceedings of The 21st ACM Conference on Information and
Knowledge Management, Sheraton, Maui Hawaii, October 29–
November 2, (2012).
TABLE III. PERFORMANCE OF ALGORITHMS ON [7] McAfee. (2014). Tweens, Teens and Technology 2014.
TEST DATA USING STANDARD FEATURES
[8] For dataset:
Algorithm ACC score Recall Precision Available: www.kaggle.com
[9] For bad words file:
Logistic regression 73.76 0.6147 0.644
Available:http://urbanoalvarez.es/blog/2008/04/04/bad-words-list/
SVM 77.65 0.5829 0.7029
[10] Hinduja, S.; Patchin, J. W. (2009). Bullying beyond the schoolyard:
Preventing and responding to cyberbullying. Thousand Oaks, CA:
Corwin Press. ISBN 1412966892.
[11] Elizabeth Whittaker & Robin M. Kowalski (2015) Cyberbullying via
Via Social Media, Journal of School Violence, 14:1, 11-29
2358 2015 International Conference on Advances in Computing, Communications and Informatics (ICACCI)