{'fraction_non_alphanumeric': 0.03395210429360918, 'fraction_numerical': 0.012073118889046337, 'mean_word_length': 4.777877845095792, 'pattern_counts': {'":': 0, '<': 1, '<?xml version=': 0, '>': 1, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 3, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Improved two-stage hate speech classification for twitter based on Deep Neural Networks

Hate speech is a form of online harassment that involves the use of abusive language, and it is commonly seen in social media posts. This sort of harassment mainly focuses on specific group characteristics such as religion, gender, ethnicity, etc and it has both societal and economic consequences nowadays. The automatic detection of abusive language in text postings has always been a difficult task, but it is lately receiving much interest from the scientific community. This paper addresses the important problem of discerning hateful content in social media. The model we propose in this work is an extension of an existing approach based on LSTM neural network architectures, which we appropriately enhanced and fine-tuned to detect certain forms of hatred language, such as racism or sexism, in a short text. The most significant enhancement is the conversion to a two-stage scheme consisting of Recurrent Neural Network (RNN) classifiers. The output of all One-vs-Rest (OvR) classifiers from the first stage are combined and used to train the second stage classifier, which finally determines the type of harassment. Our study includes a performance comparison of several proposed alternative methods for the second stage evaluated on a public corpus of 16k tweets, followed by a generalization study on another dataset. The reported results show the superior classification quality of the proposed scheme in the task of hate speech detection as compared to the current state-of-the-art.


Introduction
The global popularity of social media platforms, where users may express their opinions and interact with others online, has resulted in an explosion in the volume of data produced. Social media may reflect public sentiment and strongly influence people's opinions on various events. However, social media platforms used as pre-trained vectors in the encoding of input text.
The concept behind using word embeddings in the mechanism is to represent words as vectors, with semantically similar words assigned to vectors close to each other in the vector space. Nevertheless, any hate speech written in a way that any offensive terms are hidden behind slang words unrelated to any existing word embeddings, will remain undetected. Mishra et al. (2018b) for example reports a case of a data set of tweets containing 16 thousand unique tokens, 5.5 thousand of which are not in the English dictionary.
Among these unknown tokens, 600 are in racist tweets, while 1.6 thousand are in sexist tweets. According to Seganti et al. (2019), FastText 1M embeddings only contain around half of the words in the corpus of the typical hate speech dataset used in the SemEval-2019 competition task.
Bidirectional Encoder Representations from Transformers (BERT) models by Devlin et al. (2019), provide pre-trained vector representations of words that capture their contextual relationships in the sentence.
Despite breaking multiple records in language-related tasks, BERT falls into the same category as architectural solutions that rely heavily on pre-trained vectors of input text, and so it suffers from the same flaws.
Incorporating user-specific features, like someone's history of hate speech postings, into the decisionmaking mechanism for assessing the degree of hatefulness that may exist in his/her future postings has been shown to provide a significant performance benefit, Qian et al. (2018); Fehn Unsvåg & Gambäck (2018); Pitsilis et al. (2018); Dadvar et al. (2013); Mishra et al. (2018a). However, this technique has four main drawbacks: First, it suffers from systemic bias in discriminating against users who tend to use hatred language, thus posing ethical concerns regarding the freedom of expression. Second, it requires disclosing user identity information to third parties (e.g. service providers). That is because users' posting history contains information useful for feature extraction throughout the training process. Third, any reliance on user history data may prove ineffective when applied to new users who do not have a previous record or to others who intentionally change their behaviour in order to get misclassified. Fourth, the metadata describing a users' history may vary from one service to another, limiting the overall applicability of a system. It is worth mentioning the reduced applicability of this solution only to a small number of systems that still include user profiling in the process. We should also highlight that, due to concerns about anonymity, most datasets appropriate for training a hate speech classifier lack such user-related information, making profile-based categorization impractical in reality.
Also of great importance for the classification service is to provide comprehensive and trustworthy output. Producing detailed classification output, which indicates specific forms of toxicity such as racism, sexism, misogyny, politics and religion, instead of a binary expression (e.g. toxic/non-toxic), could be a step forward. The above forms of toxicity are not mutually exclusive, which means hate speech detection is, in fact, a multi-label classification challenge. With this in mind, a moderation system must be flexible enough to make decisions based on specific rules.
Another crucial fact concerning hate speech classification is the variation in prediction quality levels observed between each toxicity class. More particular, studies reported by scientists in the field, Pitsilis et al. (2018), indicate that racism content is much harder to identify than sexism, resulting in lower classification scores for that class, Arango et al. (2019). That is because, in many cases, racism is conveyed without the use of toxic words, resulting in false negatives. For example, the non-toxic word "black" is occasionally used for offending a specific group of people by concealing the offensive context behind a non-toxic phrase. For the opposite reason, there may be false positives, e.g. when using a toxic word for self-referential comments like "I feel like an idiot now", which usually leads to incorrect classification. In our opinion, some improved ability in detecting similar cases would be a serious step towards improving the classification performance.
Considering the above points, we summarize the design goals for hate speech classification algorithms as the following: i) Language-agnostic classification with no dependency on pre-trained word embeddings. ii) Utilizing the textual content alone for feature extraction instead of being devised from user profile data. iii) Preference for using contextualized features over contextualized word embeddings.
In this paper, to address the above issue, we propose a two-stage classification scheme. The first stage consists of multiple One-vs-Rest (OvR) Deep Learning classifiers, with their output being combined in the second stage to train another classification scheme. The second stage is where the class of abusive content is finally determined.
OvR is a heuristics method used for multi-class classification that employs multiple binary classifiers. This is accomplished by splitting the training data into several binary sets, one for each class, a strategy that works well when dealing with a small number of classes. Other researchers, Zhou et al. (2012) have noted that it is preferable for the learning process when there are numerous labels for expressing the subconcepts of the original data (e.g. sub-classes of hatred language: sexism / racism / neutral) than when only binary-labelled data is available (e.g. aggressive / non-aggressive).
Furthermore, incorporating OvR classifiers in the model, rather than just employing a single multiclass classifier, is preferable for its flexibility for fine-grained classification while yet providing improved classification quality, Dinakar et al. (2021).
Given the above, providing a solution capable of dealing with various toxicity classes is still feasible.
Although the employment of OvR schemes alone in text classification is not in itself a significant contribution, our aim in this study is to demonstrate how fine-grained classification for toxic language can be achieved by combining various conventional concepts into a single mechanism. In addition, although our experimentation is limited to distinguishing only sexism and racism from the neutral text, our concept can easily be extended to support more classes of toxicity and text content written in many languages other than English.
Our main contributions are: i) A neural network-based architecture for classifying hate speech content, consisting of several OvR Deep Learning classifiers into an ensemble scheme. ii) A model for hate speech detection with language-agnostic ability, which in theory can be trained on labelled data in the language of preference. iii) A comparative experimental evaluation of the proposed architecture on a dataset of tweets, in relation to other state-of-the-art solutions. iv) A generalization study of the proposed model by testing on another set of hate speech data with a comparison of performance against state-of-the-art algorithms.
The rest of the paper is organized as follows: In section 2, we elaborate on the details of the problem of hate speech that we come to address, and in section 3, we refer to existing work in the field. In section 4, we present our solution in more detail, and in section 5, there is a comparative evaluation of its performance.
Finally, in section 6, we summarize our contribution and outline possible future work.

Problem statement -Motivation
The problem we address in this paper is described as follows: Given a set of text postings submitted by different users, each posting may contain several words. Let "Sexism", "Racism", and "None" be three categories, with the first two stating the type of abuse in the textual content, while the third one stating the absence of abuse. In addition, each posting is limited to being a member of only one class of hatred language. Given that postings may contain out-of-vocabulary words, we assume that there is no other available information to associate postings and users who submit them. Based on these facts, the challenge is determining the class to which a new unlabeled text posting belongs.
The research question addressed in this work is: How to effectively determine the class of hatred language included in some postings that may contain out-of-vocabulary words while omitting any profile-related information that could make the posting users identifiable?
To answer this question, our main goals are summarized as follows: • To develop a novel classification method that can improve the state-of-the-art, in terms of classification performance, without sacrificing users' privacy.
• To develop a method for fine-grained detection of abusive language independent of the linguistic rules or vocabularies used and investigate the impact of such requirements on its performance.
Note that, in many existing solutions, to improve performance, they resort to tactics of utilizing users' posting activity data along with the text postings themselves. Meanwhile, other non-profiling oriented solutions are only effective for certain classes of hate speech. In our opinion, the hate speech detection tasks should be compliant with the privacy concerns of GDPR 1 , thus focusing on the language used rather than the users' identity. Our work is a step towards creating effective hate speech classification methods that require minimal input information to train a decision-making mechanism.

Related work in hate speech classification
The problem of hate speech has drawn public attention, Al-Hassan & Al-Dossari (2019), with many research groups around the globe making efforts to address the issue systematically. Existing solutions range from simple word-based approaches to complex artificial intelligence algorithms that employ Neural Network architectures. The former applies NLP rules to input data, thus operating as supervised learning classifiers.
In general, NLP solutions exploit the lexical and syntactic features of sentences, Chen et al. (2012). In fact, for the problem of hate speech, NLP solutions prove to be ineffective, as they fail to identify the subtle offensive content in user-generated text, mainly due to word ambiguity and spelling variation problems, Schmidt & Wiegand (2017). Moreover, the complexity of the natural language constructs, along with the fact that, quite often, there is a deliberate replacement of individual characters of offensive words with special ones to become undetected, are the two areas in which traditional unsupervised learning models fall short.
Using pre-trained word embeddings, such as GloVe by Pennington et al. (2014) or Word2Vec by Mikolov et al. (2013), to encode input data is a fairly common technique used in NLP tasks, known to provide improved performance over random vector initialization. In hate speech tasks, this solution, despite the performance penalty due to the limited number of words that can be associated with pre-trained word vectors, is nevertheless adopted by the vast majority of hate speech classifiers in the literature As far as the supervised learning classification solutions, in a work by Davidson et al. (2017), hate speech in a short text is distinguished from the ordinary offensive language using Support-Vector Machine (SVM) and Logistic Regression (LR) classifiers. Meanwhile, Jha & Mamidi (2017), interested in detecting sexism alone, have applied FastText, an algorithm by Joulin et al. (2016), along with SVM classifiers in their model.
Deep Neural Networks (DNN) is a type of supervised learning approach, able to solve problems end-to-end.
That is, they use labelled data to extract features from, and therefore they can handle text classification tasks quite well. Convolutional Neural Networks (CNNs) and Recurrent Neural Networks (RNNs) are the two main architectures suitable for this task. RNNs have short-term memory characteristics, and therefore they can handle dependencies in the input data sequences. Gambäck & Sikdar (2017); Park & Fung (2017) are some examples of works that use encoded input information in the form of characters and word n-grams to train CNN-based models.
Unlike CNN, Long Short-Term Memory (LSTM) is a type of RNN that captures long-term dependencies between words, and therefore it is made more suitable for text data. The solutions by Badjatiya et al. (2017); Pitsilis et al. (2018) are some of the works in the area of hate speech detection, based exclusively on either LSTM or bi-directional LSTM (BiLSTM) architectures, Agrawal & Awekar (2018); Grosz & Conde-Cespedes (2020); Qian et al. (2018). Gated Recurrent Unit (GRU) by Cho et al. (2014) is another type of LSTM architecture that is becoming increasingly popular for a variety of classification tasks. In NLP tasks, GRU-based networks perform similarly to LSTMs, but interestingly, they perform best only when applied to particular datasets with short text content, such as tweets, Paetzold et al. (2019); Mahata et al. (2019).
To improve detection performance, other researchers have introduced hybrid approaches that combine CNN and RNN architectures of various types that are also worth mentioning, Siddiqua et al. (2019); Meyer & Gambäck (2019). In addition, some solutions incorporate Attention Mechanisms into LSTM-based designs, Nikhil et al. (2018); Grosz & Conde-Cespedes (2020); Agrawal & Awekar (2018); Karatsalos & Panagiotakis (2020). Attention overcomes the limitations of LSTM, forcing any input sequences to be encoded into internal vectors of constant length, thus making this mechanism effective for very long sentences. Finally, in another interesting work by Kapil & Ekbal (2020) that also falls into this category, knowledge from different trained models is used to enhance the classification performance of a multi-task LSTM-CNN model. In most examined cases of models of this category, the class of an input sample is determined by a single vector, resulting from the concatenation of all first stage output vectors. In another, more sophisticated solution by Meyer & Gambäck (2019), the output of the first stage is merged through a dense layer to form the classification result of the second stage.
In addition, there is a specific category of multi-stage classifiers, which incorporate ensemble learning into the classification process. Based on the principle of combining multiple low-performance classifiers to produce a high-performance model, ensemble learning has proven effective in most machine learning tasks. In this learning scheme, the first stage employs several classifiers based on various neural network architectures such as CNN, RNN, GRU, etc., or classic ones such as XGBoost, ADAboost, LR. The output of these is then combined in the next stage to determine the class of the text input. This is performed either through The problem of detecting aggressive language that uses out-of-vocabulary words has also been approached by several researchers, Madisetty & Sankar Desarkar (2018); Raiyani et al. (2018); Liu et al. (2020), distinguishing the Overtly Aggressive hateful textual content from the Covertly Aggressive. Nevertheless, no results exist so far to demonstrate any performance gain over the classic approaches, nor are there many differences between the strategies used to detect direct and indirect aggression.
As for the language the hatred content is written in, most of the solutions in the literature refer to methods whose effectiveness has been demonstrated only for English text content. Moreover, a small number of works that deal with the hate speech problem in other languages, such as Portuguese, German, Arabic, Hindi, Italian, use algorithms adapted to the specifics of each one. Nevertheless, to the best of our knowledge, no method exists today to provide language-agnostic features, mainly due to the limitations imposed by the employment of pre-trained word embeddings.
A summary of the existing solutions to hate speech classification, along with their characteristics, is presented in table 1. Column 2 refers to the central components of each presented solution. In column 3 is shown the variety of classes of hate speech that can be detected, while column 4 shows the number of classification stages involved in each algorithm. Column 5 lists the datasets used in model evaluation, with twitter being the most popular. In column 6 is shown the type of word embeddings used in each approach.
As shown in the table, most of the approaches listed are dependent on pre-trained word embeddings. Finally, the last column provides additional information on user characteristics employed in model training.
It is also interesting to note the inherent difficulty of the hate speech challenge itself, stated by the fact that no solution, thus far, has been able to obtain an F-score above 0.93 overall, nor above 0.70 for the racism class alone, in multi-class datasets, such as by Waseem & Hovy (2016). Despite the plethora of solutions to the hate speech problem published so far, we believe that further performance improvements are still feasible through proper fine-tuning and alterations to the existing algorithms.

Proposed Framework
This section describes the system architecture for the proposed two-stage hate speech detection approach.
As mentioned above, to take advantage of the multi-label data, in our approach, we apply the concept of multi-label classification in the first stage.
The concept of multi-label classification is not new, but it is becoming increasingly popular in modern applications, Tsoumakas & Katakis (2009). Problem transformation is a sub-category of this classification concept. According to this, the initial problem of classifying samples on multi-label data is transformed into a series of classification problems on single-label data. This approach is beneficial for data with overlapping classes in the feature space, (i.e. labels not mutually exclusive). To apply this concept of multi-label classification to our particular case, we first convert our multi-label data into multiple single-label datasets, with each one then used to train an individual OvR classifier. By this step, a series of intermediate classification output is produced. The intermediate classification result produced by these classifiers is then incorporated into the second stage, where the final category of a given sample is determined. Also very important for our task is to capture any indirectly expressed toxicity.

Capturing Indirect Toxicity
According to other scientists in the field, Arroyo-Fernández et al. (2018), it is very common for aggressive language to be expressed indirectly, e.g. in the form of sarcasm. That usually happens when using descriptive language containing either out-of-vocabulary words or just common phrases. Capturing such text expressions requires the modelling of additional linguistic information, such as likely dependencies between strongly connected words in the sentence, based on the principle that: the next word appears according to the word before it. For the detection of racism, however, such modelling seems very promising because it is usual in verbal communication to convey such a form of hate speech without necessarily using toxic words. Using word n-grams is one way to capture the above requirement. As also observed by Nobata et al. (2016), using any n-gram word-based features, can improve performance in the task of detecting hate speech in English, rather than using only word-based features. Inspired by this, in our design, along with features based on word uni-grams, we also incorporate word bi-grams and tri-grams, thus capturing the sequence of adjacent elements as additional features.

First stage classification
Let D be the set of samples and L = {l S , l R , l N } the labels corresponding to these samples. In a single, multi-label classification scheme that works on three-label data, for the output class of a sample x ∈ D, the following holds: H : x → {p S , p R , p N }, with p (i) the predicted probability for sample x to receive label In our problem transformation scheme, the initial set D is converted to |L| sets, with each one corresponding to the labels "Racism", "Sexism", and "Neutral", respectively. Each new set includes all the samples of the original one (|D S |= |D R |= |D N |= |D|), but with their labels converted to the relevant binary value.
As a result, the training scheme then involves |L| binary classifiers instead of just one, so that the output for the class label l ∈ {l S , l R , l N } of a given sample x is as follows: To serve the additional requirement to detect, through the classification scheme, possible indirect toxicity expressed in racism, we incorporate two other binary classifiers into our design. To extract additional features from word bi-grams and tri-grams requires to have two other datasets D R2 , and D R3 , respectively, derived out of the original set D, with sizes equal to: |D R2 |= |D R3 |= |D|. As with standard classifiers, for the additional ones, the following holds for the class output of a given sample x: H R2 : x → (p R , p ¬R ) and  In our design, we chose to apply a single Deep Learning model to all of the first stage binary OvR classifiers described above. Having to deal with sequential data such as text, we chose to employ an LSTM-based model. As with RNNs, Sequential Memory is a key feature of LSTMs, making this type of neural network suitable for text sorting. This is because, in sequential memory, a signal that passes to the next neuron depends, to a certain degree, on the content of the previous neurons in the network, Lipton et al. (2015). That makes it possible to capture the sequence of words in a sentence. Unlike RNNs that suffer from the vanishing gradient problem, LSTMs have longer short-term memory, and therefore improved ability to retain longer sequences. In addition, to achieve a substantial performance improvement, we have selected an enhanced type of LSTM, called bidirectional LSTM (bi-LSTM), which contains both forward and backward layers. That is, one layer, which is a reversed copy of the other, allows the neural network to look into words occurring both before and after the current one. For our design, we chose to implement a uniform Deep Learning architecture, shown in fig.2 and apply it to all OvR first stage classifiers. As such, their input vectors can consist of either word uni-grams,bi-grams or tri-grams. This architecture comprises four layers, described as follows: • Input (a.k.a Embedding) layer. The input dimension determines the vocabulary size, with its value set to 25k, 120k and 180k for the case of uni-grams, bi-grams and tri-grams input, respectively. The selected values approximate the number of unique n-grams in the input datasets. Also, the size of the input sequence is set to 30, indicating the maximum number of words the system can handle for each sample of input text.  • The Hidden bi-LSTM layer. The bi-directional LSTM is the main layer for processing text sequences of any type of word n-grams, and it is fully connected to both the Input and the subsequent layer.
Based on preliminary experiments, the output space was set to 30 so that it is equal to the number of features on the Embedding layer. Sigmoid is the chosen activation function.
• Dense layer. This layer was added to receive the output of the bi-LSTM layer and improve the learning.
The size of this layer was set to 30 so that it is equal to the input text size on the Embedding layer.
ReLU (Rectified Linear Unit) is the activation function used.
• The Output layer. This layer consists of only 2 neurons to provide output in the form of probabilities for the l and ¬l class. Consequently, softmax was chosen for this layer, as the most suitable activation function for this type of output.
For the training process, binary-cross-entropy is the loss function chosen as the most suitable for two-class output.

Second Stage Classification
The general idea is to use the predictions generated over the first stage, as features for the training of the second stage classifier. In fact, for a given sample x, the output from each first stage OvR classifier has the form of two-tuple (p (i) , ¬p (i) ), for which holds: ., c} denote as the classifier, and c ∈ {3, 5}. All two-tuples created are then combined into a single vector with concatenation.
Next, the label initially given to sample x is attached to the concatenated output, thus creating the input features for the second stage classifier. The resulting vector has either a 9-tuple or 13-tuple form T : , depending on the actual number of OvR classifiers selected in the scheme. The correspondence between the initial label of a sample and the values B S , B R and B N is given The final class H class determined for a new sample x in the second stage is derived by a function f (), as described in equation 2. Y denote as the set of the classification output values y, generated in the first stage.
In our comparative study, we tested various alternative algorithms suitable for the task of the second stage. These include several conventional boosting & bagging, such as: Logistic Regression, Random Forest, Adaptive Boosting, Gradient Boosting and Extreme Gradient Boosting. We also proposed and tested a Deep Learning architecture that combines the output of all first stage classifiers. Finally, we introduced a simple ensemble scheme, which employs a set of fixed criteria to implement the function f (), as described in more detail below.

Logistic Regression (LR)
We chose to include this algorithm in our experimentation because it is a simple, fast, and efficient classification method. LR is a statistical model which uses, in its primary form, a logistic function to model a binary dependent variable. Variants of this model are also suitable for the classification of non-binary dependent variables.
In our scheme, the output generated by the first stage OvR classifiers becomes the input variables in the LR. In our particular case, we limited our experimentation to the following loss functions only due to their suitability to produce multi-class output: i) Stochastic Average Gradient. ii) Limited-memory BFGS.
iii) Newton Cost Function. To optimize the result, we tried all the above loss functions in every fold, from which we finally selected the best one.

Random Forest (RF)
This one is a variant of a bagging algorithm by Tin Kam Ho (1995). As its name implies, in Random Forest, multiple decision trees are formed and run in parallel on a different sample of data, making up a forest of classifiers that work as an ensemble. Each sample is a sub-sample from the original data, provided as input to the second stage of classification. In this way, a low correlation is achieved between the individual decision trees, automatically correcting the output from the individual trees and thus minimizing the error. The class prediction of each tree is taken into consideration in a voting scheme to decide the finally determined class of an input sample.
We experimented with various numbers of trees in the forest, as well as with tree depths, ranging from 1 to 100 and 10 to 30 respectively.

Adaptive Boosting (AdaBoost)
In contrast to bagging algorithms and their limitations imposed by the parallel training, in boosting algorithms instead, several low-performing weak learners are employed and trained sequentially. In AdaBoost, an algorithm by Freund & Schapire (1996), the classification decision evolves via a voting scheme among learners. The errors of the data points are re-weighted through iterations, giving greater weight to those not well classified.
In its general form, the output class, for two-class classification problems, is provided by the following equation: where f m denote as the learner m out of the M used, and θ m the corresponding weight to that learner.
While the standard algorithm refers to binary classification, for our three-class problem, we chose a variant that incorporates an ensemble of binary decision trees (BDT) and is, therefore, suitable for multiclass output. Simply put, a multi-class problem breaks down into several binary classification problems solved by standard AdaBoost classifiers, Fleyeh & Davami (2013). To reduce overfitting, we experimented with a range of learning rates, from 0.01 to 0.14, and various binary trees from 5 to 50 to optimize the algorithm.

Gradient Boosting (GBoost)
Like AdaBoosting, Gradient Boosting by Friedman (2001), combines weak learners, but without limiting the depth of the Decision trees to just one.
The objective of the first iteration is to fit the model to the complete data. Then, in the subsequent iterations, a new weak learner is added to the model to increase the performance and thus build a strong learner. The new weak learners concentrate on those areas where the performance was still poor in the current step until the model fits the data exactly.
In our scheme, we chose the deviance loss function for its suitability for multi-class classification. We also experimented with a range of learning rates, from 0.10 to 0.20. In addition, we tested the algorithm for a range of binary trees from 20 to 100, while limiting our experimentation to decision trees to depths of 2 and 4 only, from which we selected the best combination.

Extreme Gradient Boosting (XGBoost)
XGboost algorithm by Chen & Guestrin (2016), is a variant of Gradient Boosting, but improved for speed and performance, which uses the second order derivatives of the loss function to minimize the error.
Also, the binary decision trees in XGBoost can have a varying number of terminal nodes. The advanced regularization of this type which improves generalization is another advantage over the standard Gradient Boosting. We experimented with a range of binary trees from 20 to 30, with a maximum depth of 2, and learning rates ranging from 0.1 to 0.22, from which we chose the combination with the best performance.

Deep Learning (DL) with Stacked Ensemble
Deep neural networks, among other uses, have also been found suitable for classifying patterns of sequences of numbers, Gao et al. (2018). In this regard, we are considering using LSTM-based Deep Learning models for the second stage classifier training task.
The LSTM-based architecture employed in our design is illustrated in fig.3 and comprises three layers, described as follows: • class for a given sample is determined via a Majority Voting scheme, which combines the classification output from all first stage classifiers, as shown in eqn.3, and it works as follows: Given a model with M stacked instances, then for an input sample x, the predicted frequencies for the neutral, sexism and racism class is calculated by summing the adjacent frequencies across all M instances.
Next, the H class (x) label finally determined for sample x is given to that class j ∈ {l S , l R , l N } having the highest summed frequency. k i,j ∈ {0, 1} denote as the predicted probability for class j, computed by the ensemble instance i, while P is the cumulated prediction score over all P j values for sample x.

Fixed Criteria Ensemble scheme
We propose an alternative scheme for application in the second stage for determining the class of textual postings. In this scheme, we employ a simple and intuitive mechanism, based on fixed criteria, to aggregate the output of all first stage OvR classifiers into a single score. In total, we propose two forms of the scheme, for comparison. We apply this dual-form testing as a means to investigate the effectiveness of the proposed scheme on capturing the indirect toxicity expressed over racism. While the first one considers only the word uni-grams criteria, in the second one, the classification scheme incorporates the word bi-grams and tri-grams along with the uni-grams.
The first form is described by a function h() : x → {l S , l R , l N }, we introduce in eqn.4, which determines the class label of an input sample x. p N , p S and p R denote as the positive class probability values of the prediction scores obtained for neutrality, sexism and racism by the relevant first stage classifier, respectively.
The intuition behind function h() is to assign to sample x the class label for which the adjacent first stage classifier has obtained the highest predicted score for that sample.
The second form of the proposed scheme is shown in eqn.5. The most obvious difference with the previous one is the replaced p R class probability by the average of the three probabilities values of the racism class: (p R2 (x),p R3 (x),p R (x)). The purpose is the inclusion of word bi-grams and tri-grams, along with the unigrams in the scheme. The reasoning behind selecting the average value was to consider, equally in the class decision, all features related to racism.

Evaluation
To demonstrate the effectiveness of the proposed classification algorithm, we implemented the scheme shown in fig.1 and evaluated it over a legacy dataset suitable for this task. Furthermore, to test how well the model generalizes, we conducted experiments of the trained models over another public dataset, which we used as the test set. For both datasets, we first applied the necessary pre-processing, as further explained in this section below.

Dataset
To evaluate the model, we used an existing dataset with approximately 16,000 tweets by Waseem & Hovy (2016). This data set is an established and accepted standard for this evaluation task and it is constantly cited as a valuable resource. That makes it suitable for producing comparable evaluation results against other state-of-the-art solutions. Moreover, other researchers, such as Mishra et al. (2018b), who analyzed the textual content of this dataset, report the existence of a large number of tokens that are not included in the English dictionary, which, however, appear mainly in racist and sexist tweets. More specifically, 5.2 thousand of the 16 thousand unique tokens found in the dataset do not exist in the dictionary. This feature makes the data set ideal for investigating any indirectly expressed hate speech.
Using the public Twitter API, we were able to retrieve 15998 tweets, of which 1943 labeled as racism, 3166 labeled as sexism, and 10889 labeled as neutral (i.e., tweets that do not contain either sexism or racism). The discrepancy observed regarding the quantities between the data we retrieved and the original set is because a number of tweets have been removed from the Twitter service.

Pre-processing
Before training the first stage classifier, it is necessary to apply the proper pre-processing to the labeled input tweets. That includes Tokenization, Encoding, and Data Augmentation, which we describe in the following sections.

Tokenization
Tokenization is the process by which the text corpus is split into word elements, taking into account white spaces as well as various punctuation symbols used in the language. For achieving this, we used the Moses 2 package for automatic translation. It is worth mentioning that emojis, special characters and other symbols, such as "@" used in email addresses, were retained in the dataset as we intended. The objective was to train the model with the most realistic, high-quality data, as these symbols are often used on social media to obscure hate speech.

Encoding
To fulfil our initial goal of maintaining independence from any linguistic rules and vocabularies, we choose to model the input tweets in the form of vectors using Word Frequency Vectorization. We apply this technique to associate each word in the corpus with a unique identifier. More particularly, in this type of vectorization, each word is indexed based on the frequency of appearance in the corpus. The index value given to each word in a tweet is used as a vector element to describe that tweet. Despite the potential loss of generalization, this modelling provides the flexibility to support, in theory, messages posted in any language.
To encode the attributes of the word bi-grams and tri-grams for each tweet, we apply a similar scheme of frequency vectorization. First, we generate two more corpora, one for the word bi-grams and another for the tri-grams. With this, a new unique identifier is assigned, respectively, to each two-word and three-word sequence appearing in the original corpus. In this way, each input tweet can be described as a vector in the bi-gram and tri-gram spaces. Speaking in numbers, in the evaluation dataset, the corpora of uni-grams, bi-grams and tri-grams finally comprise 25k, 120k, and 180k unique words, respectively.
Unlike other models that use pre-trained word embeddings for text encoding, any toxic expressions such as "son of a b****" that contain out-of-vocabulary words, can still be classified as such by our approach.
The choice of vectorizing the sentences into n-grams, advances our proposed model so that it can tolerate similar cases of obfuscated hate speech. More important, this feature is provided in a free of pre-trained word embeddings scheme.
Finally, we choose to limit the maximum size of encoded tweets that will be taken into account in the model training to only 30 words. As a result, any tweets longer than this size were truncated, while any shorter ones were padded with zeros. The same rule applies to all tweet embeddings associated with word uni-grams, bi-grams and tri-grams, limiting their size to 30 elements. This value is marked as 'input dimension' at the embedding layer in all first stage OvR classifier models.

Data Augmentation
Augmenting the training data is often necessary when the class distributions are highly imbalanced.
Otherwise, using an unbalanced data set usually has an undesirable impact on the calculated F-score, with its value being strongly biased towards the majority class. That produces many false negatives, which is undesirable in algorithm evaluation. To give a figure of the level of imbalance occurring in the original dataset, we mention that the "neutral" class alone accounts for 68% of all samples. For our proposed scheme, we look into the employment of data augmentation for both stages of the classification task.
As for the first stage of our scheme, possible options include the implementation of a simple data replication scheme or the employment of more advanced techniques, including a machine translation service, Karatsalos & Panagiotakis (2020); Risch & Krestel (2018a). However, the latter option requires the involvement of third-party language services in the scheme, with high dependency on linguistic rules and vocabularies, and is therefore not recommended for our problem. For this reason, we chose the solution of data replication, which is much simpler. With replication, to achieve a proper balance between the classes, the minority classes are over-sampled, using the original data. The augmented data set is then appended to the original set, a practice that is quite common in hate speech literature, Seganti et al. (2019); Agrawal & Awekar (2018). It is important to note that, in data augmentation, over-sampling should only be applied to the training set, to avoid over-fitting in the resulting data.
For the first stage, we over-sampled the classes of "sexism" and "racism", twice and thrice respectively.
As a result, these classes increased in size to 6,332 and 5,829 samples, respectively. After incorporating the augmented toxic classes into the original 10,889 tweets of the "neutral" category, the training set finally expands to 23,050 samples.
In the second stage, the necessity for data augmentation stems from the fact that the minimal data produced in the first stage on each fold is rather inadequate for training properly the second stage classifiers.
In fact, as mentioned earlier in section 4.3, using a limited dataset to train the second stage classifier would almost certainly result in high instability and overfitting. Using a simple oversampling scheme identical to the first stage, on the other hand, would most likely be insufficient to address the overfitting problem.
For that reason, large-scale augmentation appears to be a viable option for our setup to achieve notable performance improvement.
In our augmentation scheme, new artificial samples are created for each class within the same dimensional space while maintaining a high similarity to the existing ones. Algorithm 1 explains the technique in detail.
The set of samples belonging to the specific class (i.e., "sexism," "racism," or "neutral") that we wish to augment is denoted by < original dataset >, and N denote as the new set of data generated by the algorithm. The Maximum Divergence Value (mdv) is a parameter used in data generation to determine the preferred level of similarity between class probability values within the same class. For our setup, the mdv Algorithm n ← trunc(n) ⊲ truncate value within range (0,1)

12:
N ← N ∪ {n} ⊲ append to augmented set value is set to 0.02 to generate samples with numerical values that deviate from the original by no more than 2%. The chosen value was determined by trial and error to achieve the best results. It is worth noting that the large number of combinations generated by the augmentation algorithm minimizes the likelihood of overlapping samples. The probability of overlap is given by: p = 1 (10 x ) y . The significance value x reflects the level of consideration given to the output of the first stage classifiers, whereas y denotes the number of those incorporated in the scheme. The significance relates to the number of numerical digits allotted for expressing the output scores, as specified in section 4.3.6. In fact, in our setup, where x = 2 and y ∈ {3, 5}, this probability is indeed very low (p = 10 −10 ). Eventually, with the application of the augmentation algorithm 1, the data for training the second stage increased by over 43 times per run. This resulted in an additional 80,000 samples being added to the 1,872 samples generated by the first stage for each subset.

Experimental Setting
To maintain consistency with the results produced by state-of-the-art methods, such as Badjatiya et al. (2017); Agrawal & Awekar (2018); Pitsilis et al. (2018) and others, we used the same 10-fold cross-validation scheme in our evaluation. The Deep Learning models used in both stages were implemented using Keras 3 .
In our experiment, we set the vocabulary size for the first stage models based on uni-grams, bi-grams, and tri-grams to 25,000, 120,000, and 180,000, respectively, to match the size of the corpora and hence maintain compatibility with the encoded input vectors used in these models (see paragraph 5.2.2). For the Deep Learning with Stacked Ensemble scheme employed in the second stage, the vocabulary size must be equal to the size of the vector space of the combined first stage output, with value: c × 2 × 10 m . As mentioned earlier, the value of m indicates the level of weight given to the output of the first stage classifiers and denotes the number of digits used to express each two-tuple probability. For instance, we set m = 2 to allow the Deep Learning Stacked Ensemble classifier to recognize 100 different output states. Indicated by the letter c is the number of classifiers whose output is incorporated into the second stage. We investigate two options: i) c = 3 which refers to the variation which considers just the word uni-grams, and ii) c = 5 which refers to the variation which considers the word bi-grams and tri-grams in addition to uni-grams. For the above options, we set the vocabulary size value for the second stage to 600 and 1,000 respectively.

Model Training
There is growing interest in using large batch size in training DL models with stochastic gradient descent since this can reduce learning time, Hoffer et al. (2017). However, the use of a large batch size is also known to improve the generalization performance. The conventional stochastic gradient descent, on the other hand, maintains a constant learning rate throughout the training. The general rule to counteract a large batch size is to pick a suitable learning rate or develop a good schedule for it.
Other algorithms, such as Goodfellow et al. (2016), suggest using an adaptive learning rate, in which the value of the learning rate increases and decreases throughout the training process based on the error in the loss function. Despite that, no single solution exists so far to be the most effective for any given problem. In our case, rather than adopting one of the most well-known adaptive learning policies, such as AdaGrad, RMSProp, or Adam, we have chosen to create our pre-defined schedule with an adaptable learning rate that will be adjusting as the training develops. The general idea is that, while batch size is set to a big fixed number, the learning rate should be declining as the training progresses. The rate of decline should depend on the impact on both the prediction accuracy and the error that occurred in the loss function approximation.
To train our models, we implemented an optimization rule described in algorithm 2. In this algorithm, the value of the new learning rate depends on the number of epochs (ep) elapsed since its last update, and update LR is calculated using formula 6.
LR (e=ep) denote as the new learning rate, set at epoch ep, whereas LR (e=1) is the initial value given to the learning rate in the first epoch. For each model, the optimal value for the LR (e=1) was determined by trial and error. More particularly, for the training of the first stage OvR classifiers on uni-gram data, the LR (e=1) for the racism, neutral, and sexism classifiers was set at 0.08, 0.08, and 0.10, respectively. As for the classifiers trained over bi-gram and tri-gram data for the racism class, the LR (e=1) value was set to 0.05.
We applied the same trial and error policy for setting the decay rate (dR) value. As such, its value was set to 0.15, 0.15, and 0.20 for the training of the unigram-based models for racism, neutrality, and sexism, respectively. Similarly, the chosen (dR) value for training the bi-gram and tri-gram models was 0.20 and 0.18, respectively. Finally, the model training was allowed to run for a maximum of 200 epochs.
Concerning the batch size, we set a different value for each stage. More specifically, the DL classifiers in the first stage were trained with a batch size of 1024, whereas the DL Stacked Ensemble classifier in the second stage was trained using a larger batch size of 8192. Both values remained constant throughout the training process.
In algorithm 2, the optimally trained state of the model, which corresponds to the best combination of Validation Accuracy and Error, is preserved throughout the training process to be used in model validation afterwards. To achieve stability in the results produced, we repeated each experiment ten times, with the same data, and averaged the output values.

Performance Metrics
To demonstrate the effectiveness of our approach, we used standard metrics of classification accuracy, such as: Precision, Recall, and F-score. More specifically, we report the micro averaged values of the F-score metric for two reasons. Firstly, to maintain consistency with previous work in the field, and secondly, for the suitability of the micro average for evaluating unbalanced test sets, as it incorporates class frequencies in the F-score value calculation. The Precision (P) and Recall (R) values for a specific class are derived from the True Positive (TP ), False Positive (FP ), and False Negative (FN) instances by: P = T P (T P +F P ) , R = T P (T P +F N ) . P is defined as the fraction of correctly classified tweets in a given class among all tweets classified in that class, whereas R is the fraction of correctly classified tweets in a given class among all tweets in that class. Furthermore, the F-score metric is the harmonic mean of P and R, expressed as: F = 2·P ·R P +R . In the case of multi-class classification, the total micro average value of the F-score is given by: where n class−i denote as the population of a particular class i, whereas F class−i is the F-score obtained for the tweets of that class.

Results -Discussion
We present the most significant results from our experiments. We contrast our results against other stateof-the-art algorithms for hate speech detection, which have been evaluated over the dataset by Waseem & Hovy (2016). In our comparison, we also include the algorithm developed by Kapil & Ekbal (2020), which was tested on the same dataset. However, despite attaining the best F-score ever, their reported results for this algorithm are not directly comparable to ours for two reasons: First, according to Kapil & Ekbal (2020), the model training was done using a smaller subset, and second, the training process was reinforced by knowledge from other hate speech datasets.
From the results presented in tables 2 and 3, we observe the following: • Our approach outperforms all the alternative algorithms by other researchers in the field comprised in our study. That includes both the supervised and the unsupervised learning solutions. More specifically, among the current state-of-the-art, our best performing model achieved an F-score of 0.9351, compared to 0.9320 by the second-best solution by Pitsilis et al. (2018).
• In terms of which of the proposed alternative algorithms for the second stage task performs best, we observe that the highest F-score = 0.9351 was attained by the Fixed Criteria Ensemble scheme, while the Deep Learning scheme achieved the second-best score with 0.9339. We attribute the reason for the inferior performance of the Deep Learning scheme to the limited amount of data used for training. In particular, training the first stage classifier over a small dataset of only 16k tweets, as we did, produced insufficient data for training the second stage classifier. Testing on a larger dataset of labelled tweets, on the other hand, could be in favour of the Deep Learning scheme.
• Regarding the potential benefit in racism detection provided by incorporating bi-grams and tri-grams features into the training process, we note that there is indeed a performance benefit (see column labelled "5 OvR classifiers" in Tables 2 and 3) over using only uni-gram features (see column labelled "3 OvR classifiers" in Tables 2 and 3). More specifically, as can be seen in Table 2 (see column labelled "F R ", showing the actual improvement in terms of the F-score for the racism class), in all schemes we introduced, racism detection alone was benefited from the use of additional features by at least 0.055%. As can also be observed, XG Boosting is the most affected algorithm for the second stage, raising the F R by 1.014%, followed by Gradient Boosting, which improves the F R by only 0.848%. On the contrary, the Fixed Criteria Ensemble is the least affected alternative for detecting racism. For  Kapil & Ekbal (2020) Multi-task LSTM N/A 1 N/A 1 0.9410 (trained on mixed datasets) 1. A score marked as N / A indicates an unavailable result from the original paper 2. The F, P, and R values shown are averages of multiple experiments 3. Used amended scores by Arango et al. (2019) the remaining classes of sexism and neutrality, the incorporation of extra features resulted in a small benefit observed. Regarding the overall F-score for all three classes (see the column labelled "F tot " in table 2), the Fixed Criteria Ensemble appears to be the most benefitted scheme by the incorporation of bi-gram and tri-gram features, by 0.172%.
• Compared to other state-of-the-art algorithms, the use of pre-trained word embeddings in our model provides a noticeable benefit in terms of classification accuracy. From the results, we observe that our technique outperforms all other algorithms examined on the same dataset, such as Park & Fung Agrawal & Awekar (2018); Badjatiya et al. (2017), that incorporate various types of embeddings into the input data encoding. Considering the above finding, we conclude that the use of word embeddings is not a panacea for improving performance.
In addition, as opposed to other single-stage solutions that do not use pre-trained word embeddings, our proposed scheme of OvR Deep Learning classifiers still does better in the multi-class hate speech detection task. For instance, our approach outperformed Waseem & Hovy (2016); Waseem (2016) LR-based models by 26.49% and 2.16%, respectively, and it is also 0.34% more efficient than the single-stage DL-based solution by Pitsilis et al. (2018).
Given the above observations on the results, one of the future challenges may be to evaluate our supervised learning methods on datasets large enough to produce adequate data to train a second stage classifier. Since our model outperforms similar approaches, like Waseem & Hovy (2016); Pitsilis et al. (2018), without necessitating any user profile information to incorporate as a feature in the training process, it is clear that high-quality hate speech detection is still viable without compromising user privacy.
Despite failing to outperform the Fixed Criteria Ensemble, the DL with Stacked Ensemble scheme remains, in our opinion, the most promising solution for the second stage classifier (see section 4.3.6). The main reason for this is that, unlike the Fixed Criteria Ensemble, the Stacked Ensemble is well suited to work in a Transfer Learning scheme. It may, for example, be modified to support complex scenarios like combining several sources of labelled data into a single vector and then using that to train the core classifier.
However, more testing is required to optimize a number of parameters, such as the number of states to discriminate from the output of the first stage, which will be utilized to train the Stacked Ensemble.
Finally, among the six alternative schemes that we proposed and tested as second stage classifier options, we recommend the following, as the most promising: i) the Fixed Criteria Ensemble, for its simplicity and high efficiency in determining the class output, ii) the Deep Learning with Stacked Ensemble, for its applicability to Transfer Learning setups for classifying various forms of hate speech, beyond sexism and racism.

Generalization
There has recently been a trend toward using automatic detection methods that work without modification across a wide range of online platforms and areas. A technique to achieve this for natural language processing tasks, such as hate speech classification, is to adapt Complete Transfer Learning, a type of Transfer Learning, in the model training. In this manner, without having to retrain a model, the knowledge gained from training on one dataset may be used to improve hate speech detection performance on new data.
Cross-Dataset Training and Testing (a.k.a Generalization Testing) is a method of determining how effectively a system can achieve the above goal by testing in a real-world scenario. The experiments reported in this section aim to investigate how effectively our model generalizes to other datasets from the same domain after being trained on the Waseem & Hovy (2016), in contrast to other techniques.
For our comparative study, we selected two state-of-the-art algorithms developed by Badjatiya et al. (2017) and Agrawal & Awekar (2018) which Arango et al. (2019) has documented in a generalization study for hate speech detection. Another algorithm by Pitsilis et al. (2018), which performed well on the same dataset, is also included in our comparison. Overall, we tested two different variations of that algorithm 4 .
The first variation, which has achieved the best F-score=0.9320 (see and we chose it because of its widespread use in benchmarking numerous models. The original SemEval dataset contains over 9,000 text samples, each with a pair of binary labels. While the first label shows whether toxic language is present in a given sample, the second label indicates whether or not that toxic language is aggressive.

Model adjustments
Due to label discrepancies between the training and testing datasets we used for the generalization study, we made several changes in the evaluation task. Although the labelling in both the training and testing data sets is suited for 3-way classification, drawing any conclusions about the test result would not be feasible due to the contextually different annotations used in these sets. To overcome this, we made appropriate changes to the evaluation task, such as rearranging the labels in the test data and transforming the classifier model schemes to fit the testing scenario.
Concerning the test data, the aim was to take into account only those series of class labels that share the same context between the training and test sets. To achieve this, we focused exclusively on the primary label of the test set, which indicates the presence of hate speech in the sample, disregarding the secondary one, which further differentiates hate speech into aggressive and non-aggressive forms. Based on this, the 9k sample set was divided into 3783 hateful and 5217 non-hateful samples.
Based on this reasoning, any input sample x from the test set classified as 'Non-neutral', will be considered hate speech (H class (x) = H).
(ii) Three classifiers model (H N , H S , H R ). This method utilizes the main OvR classifiers trained on uni-gram input. Eqn.4 is modified to generate binary output as follows: and tri-gram based (H R2 , H R3 ), that served the purpose of racism detection. As such, the class label H class ∈ {H, ¬H} determined for sample x is given as follows: p R2 (x) and p R3 (x) denote the positive class output probabilities for input text sample x, of word bi-grams and tri-grams classifiers, respectively, trained on racism detection.

Data Pre-processing
The differences in terminology, idioms, and message length between the training and test data necessitated the application of filtering on the test data before the validation task. Filtering on datasets is a common pre-processing task adopted by many researchers in the area of text classification, such as, Kapil & Ekbal ( main objective of the pre-processing in our particular case was to remove the noisy text while preserving any key features. Our filtering scheme consists of seven steps applied to each test tweet in a specific order, as shown in Table 4. Order Operation 1. Removing any quote (") characters from the text 2.
Removing usernames from the text ( character strings beginning with @ ) 3.
Deleting the hash (#) symbol prefix from any hash-tags in the text 6.
Removing any retweet symbols (RT) from the text 7.
Removing non-standard ASCII characters For highlighting the impact of filtering, our results also include the case of not applying filtering to the plain test set.

Setup -Metrics
Among the alternative schemes proposed in this paper, we chose to evaluate the Fixed Criteria Ensemble only, which we describe in section 4.3.7. This one was chosen not only for its simplicity but also because it performs the best in terms of F-score rating.
To maintain consistency with the main experiment, we implemented the generalization task as part of the main 10-fold cross-validation scheme described in section 5.3. Therefore, each trained model out of the 10 created in the main cross-validation experiment was used unmodified for validation across the entire test set. The reported performance score indicates the average over 10 folds, repeated for 10 experiment runs. To quantify the performance in the generalisation experiment, we also used the metrics of Precision and Recall, with the reported F-score. Finally, the formula for the micro-average computation of the total F-score (see eqn.7) was modified for two-class output (Hatred / Non-Hated), according to the requirements outlined in section 5.6.1.

Generalization Results -Discussion
In algorithm over the filtered and the unfiltered test set. We tested two variations of this method: i) one that uses a single classifier and ignores the user's posting history, and ii) an ensemble scheme, which the authors mention as the best performing of those tested. The latter referred to as (O+NS+RS+NR+NRS) in their paper, consists of five classifiers, each of which combines different user-related features. Each feature is associated with a user's tendency to express sexism (S), racism (R), or neutrality (N) in their posts. We make the following observations based on the results shown in table 5:  (2018) method, our approach ultimately achieves a higher F-score than Badjatiya et al. (2017) and Pitsilis et al. (2018).
Moreover, despite outperforming only two out of the three other state-of-the-art algorithms (F = 0.5491), our approach still obtains a good balance between the F-scores for the Hatred and the No-Hatred classes, with values of 0.5421 and 0.5541 respectively, something that the other algorithms fail to achieve.
• As also observed, the alternative schemes of our technique that used trained classifiers with extended features for the racism class (see trained classifiers H R2 , H R3 in Table 5) do not seem to provide a significant performance benefit when tested on unseen data. On the contrary, as mentioned earlier (see   table 2), there is such a benefit when tested on the Waseem & Hovy (2016) dataset. We can attribute this to the necessary adjustments made to the evaluation task to meet the needs of the generalization study. As a consequence, while the trained model could only deal with the hate speech categories of racism and sexism, any information communicated by word bi-grams and tri-grams would remain largely unrelated between the two datasets.
• Filtering the test data prior to classification has a positive effect on performance when compared to the classification of the text in its plain form. As we observed, certain symbols and special characters, such as '#' for hashtags, 'RT' for retweets, or '@' for indicating usernames, which we filtered out of the test set, are mainly encountered in sexist tweets in Waseem & Hovy (2016) training dataset.
For instance, of the 3160 sexism labeled tweets, we found 293 URLs, 1367 'RT' symbols, and 2511 '@' characters. The effect of filtering on performance may be due to the bias of trained models in classifying any input message containing these symbols as offensive. The findings suggest that filtering may help reduce bias and thus improve classification accuracy.
• All proposed alternatives of our approach based on a single classifier, using only the Hatred / No-Harted class (cases denoted by i in Table 5), fail to outperform any alternative that incorporates multiple classifiers (cases denoted by ii & iii in Table 5). Instead, the latter seems to have a marginal advantage of 1.36 % on average. In classification problems, it is usual for ensemble-based techniques to obtain greater classification accuracy than single classifiers, and we believe our particular case falls under this category.
• When compared to the second-best alternative by Pitsilis et al. (2018), which we also included in the main experiment (see Table 3), we observe that when the filtered test set is used, our proposed method (variation ii in Table 5 with F-score 0.5491) has a marginal advantage over the above algorithm when tested on unseen data (cases denoted by the letters a,b in Table 5 with F-score 0.5420 and 0.5451). Furthermore, even though our approach does not employ user history-related features, it still generalizes better by 0.734 % than the variation by Pitsilis et al. (2018) that do (case denoted by the letter b in Table 5).
Despite outperforming the existing methods and generalising better than the current state-of-the-art, we believe our proposed algorithm's full potential has yet to be proven.
We find three plausible explanations for our algorithm's poor cross-dataset performance in the generalization experiment. First, the necessary modifications made to the evaluation scheme as a result of the different labelling used in the training and test data is a likely reason for the reduced score. Second, there is a strong user bias in the training dataset, as reported by other researchers in the field, Arango et al. (2019), which may have seriously affected the measured performance in the main experiment. The lack of such bias in the generalization dataset might explain the performance drop observed. Third, because we encoded the training data using a word-frequency vectorization strategy, many words in the test set were not indexed and so remained unknown to the classifier. For instance, only around half of the 18367 unique words from the test set exist in the training set.
In spite of the low score obtained when tested on unseen data, our algorithm performs satisfactorily well compared to other algorithms. To give an example of a typical performance reduction that may occur in generalization tests, we mention a case of an algorithm reported by Arango et al. (2019), which, after being trained on the Waseem & Hovy (2016) dataset, exhibited a dramatic drop in the value of the F-score to 0.1 when evaluated on Wikipedia data.

Conclusions and future work
Automated detection of abusive language in on-line media has become a big challenge in the recent years. In this paper, we proposed a novel approach that is an extension of an existing algorithm that uses LSTM neural networks to address the above challenge. The proposed two-stage scheme, designed for multi-label data, employs One-vs-Rest classifiers and is properly tuned and adjusted to determine the type of harassment in tweets, with high accuracy. The encoding of the input text, in a form independent of pre-trained word embeddings, is one of the innovations of the proposed approach. This feature translates into the ability to capture idioms and slang expressions, that may likely exist in the text. In addition, the model only utilizes the textual content of tweets to classify a new posting without requiring knowledge of users' tweeting history, thus respecting their privacy.
This paper has made several contributions which can be summarized as follows: i) A model for finegrained abusive text detection with language-agnostic capability, suitable for capturing hate speech indirectly expressed through obfuscated insulting terms. ii) A comparative experimental evaluation against other stateof-the-art solutions over a publicly available corpus of 16k labelled tweets. iii) A generalization study by testing on another 9k tweet dataset and comparison with state-of-the-art algorithms. iv) An implementation built on top of Keras toolkit.
The experimental results showed the superiority of our proposed design over the existing state-of-the-art algorithms in distinguishing the two types of hate speech we tested, racism and sexism, from regular text.
Also, under certain conditions, the proposed model generalizes well to other datasets. Most important, despite not using user history information, the model generalizes better than the current state-of-the-art.
Our experimentation has also revealed that fine-tuning is necessary for Deep Learning-based models to improve classification performance. Furthermore, the experimental results support the initial hypothesis that improving the hate speech classification performance does not necessitate a solution based on linguistic rules and vocabularies. Due to the algorithm's inherent suitability for language-agnostic solutions, we intend to extend our investigation to texts written in other languages.
Lastly, we believe that experimenting with a single data set, as we did, has little to offer in terms of improving classification performance. Integrating multiple datasets into a Transfer Learning setting, on the other hand, appears to be a quite promising future direction for the proposed design. For NLP classification tasks like the one we looked at in this article, it is vital to be able to explain convincingly the decisions made by an algorithm, especially when it comes to consumer services, Risch & Krestel (2018b). In the context of freedom of speech, decision justification is critical in comment moderation so that the classification result is convincing that it is not the result of censorship. Therefore, another potential area of future research could be the explainability of hate speech classification.