Text Classification Algorithms: A Survey

In recent years, there has been an exponential growth in the number of complex documents and texts that require a deeper understanding of machine learning methods to be able to accurately classify texts in many applications. Many machine learning approaches have achieved surpassing results in natural language processing. The success of these learning algorithms relies on their capacity to understand complex models and non-linear relationships within data. However, finding suitable structures, architectures, and techniques for text classification is a challenge for researchers. In this paper, a brief overview of text classification algorithms is discussed. This overview covers different text feature extractions, dimensionality reduction methods, existing algorithms and techniques, and evaluations methods. Finally, the limitations of each technique and their application in the real-world problem are discussed.


Introduction
Text classification problems have been widely studied and addressed in many real applications [1][2][3][4][5][6][7][8] over the last few decades. Especially with recent breakthroughs in Natural Language Processing (NLP) and text mining, many researchers are now interested in developing applications that leverage text classification methods. Most text classification and document categorization systems can be deconstructed into the following four phases: Feature extraction, dimension reductions, classifier selection, and evaluations. In this paper, we discuss the structure and technical implementations of text classification systems in terms of the pipeline illustrated in Figure 1 (The source code and the results are shared as free tools at https://github.com/kk7nc/Text_Classification).
The initial pipeline input consists of some raw text data set. In general, text data sets contain sequences of text in documents as D = {X 1 , X 2 , . . . , X N } where X i refers to a data point (i.e., document, text segment) with s number of sentences such that each sentence includes w s words with l w letters. Each point is labeled with a class value from a set of k different discrete value indices [7].
Then, we should create a structured set for our training purposes which call this section Feature Extraction. The dimensionality reduction step is an optional part of the pipeline which could be part of the classification system (e.g., if we use Term Frequency-Inverse Document Frequency (TF-IDF) as our feature extraction and in train set we have 200k unique words, computational time is very expensive, so we could reduce this option by bringing feature space in other dimensional space). The most significant step in document categorization is choosing the best classification algorithm. The other part of the pipeline is the evaluation step which is divided into two parts (prediction the test set and 1.
Document level: In the document level, the algorithm obtains the relevant categories of a full document.

2.
Paragraph level: In the paragraph level, the algorithm obtains the relevant categories of a single paragraph (a portion of a document).

3.
Sentence level: In the sentence level, obtains the relevant categories of a single sentence (a portion of a paragraph).

4.
Sub-sentence level: In the sub-sentence level, the algorithm obtains the relevant categories of sub-expressions within a sentence (a portion of a sentence )). (I) Feature Extraction: In general, texts and documents are unstructured data sets. However, these unstructured text sequences must be converted into a structured feature space when using mathematical modeling as part of a classifier. First, the data needs to be cleaned to omit unnecessary characters and words. After the data has been cleaned, formal feature extraction methods can be applied. The common techniques of feature extractions are Term Frequency-Inverse Document Frequency (TF-IDF), Term Frequency (TF) [9], Word2Vec [10], and Global Vectors for Word Representation (GloVe) [11]. In Section 2, we categorize these methods as either word embedding or weighted word techniques and discuss the technical implementation details.
(II) Dimensionality Reduction: As text or document data sets often contain many unique words, data pre-processing steps can be lagged by high time and memory complexity. A common solution to this problem is simply using inexpensive algorithms. However, in some data sets, these kinds of cheap algorithms do not perform as well as expected. In order to avoid the decrease in performance, many researchers prefer to use dimensionality reduction to reduce the time and memory complexity for their applications. Using dimensionality reduction for pre-processing could be more efficient than developing inexpensive classifiers.
In Section 3, we outline the most common techniques of dimensionality reduction, including Principal Component Analysis (PCA), Linear Discriminant Analysis (LDA), and non-negative matrix factorization (NMF). We also discuss novel techniques for unsupervised feature extraction dimensionality reduction, such as random projection, autoencoders, and t-distributed stochastic neighbor embedding (t-SNE).
(III) Classification Techniques: The most important step of the text classification pipeline is choosing the best classifier. Without a complete conceptual understanding of each algorithm, we cannot effectively determine the most efficient model for a text classification application. In Section 4, we discuss the most popular techniques of text classification. First, we cover traditional methods of text classification, such as Rocchio classification. Next, we talk about ensemble-based learning techniques such as boosting and bagging, which have been used mainly for query learning strategies and text analysis [12][13][14]. One of the simplest classification algorithms is logistic regression (LR) which has been addressed in most data mining domains [15][16][17][18]. In the earliest history of information retrieval as a feasible application, The Naïve Bayes Classifier (NBC) was very popular. We have a brief overview of Naïve Bayes Classifier which is computationally inexpensive and also needs a very low amount of memory [19].
Non-parametric techniques have been studied and used as classification tasks such as k-nearest neighbor (KNN) [20]. Support Vector Machine (SVM) [21,22] is another popular technique which employs a discriminative classifier for document categorization. This technique can also be used in all domains of data mining such as bioinformatics, image, video, human activity classification, safety and security, etc. This model is also used as a baseline for many researchers to compare against their own works to highlight novelty and contributions.
Tree-based classifiers such as decision tree and random forest have also been studied with respect to document categorization [23]. Each tree-based algorithm will be covered in a separate sub-section. In recent years, graphical classifications have been considered [24] as a classification task such as conditional random fields (CRFs). However, these techniques are mostly used for document summarization [25] and automatic keyword extraction [26].
Lately, deep learning approaches have achieved surpassing results in comparison to previous machine learning algorithms on tasks such as image classification, natural language processing, face recognition, etc. The success of these deep learning algorithms relies on their capacity to model complex and non-linear relationships within data [27].
(IV) Evaluation: The final part of the text classification pipeline is evaluation. Understanding how a model performs is essential to the use and development of text classification methods. There are many methods available for evaluating supervised techniques. Accuracy calculation is the simplest method of evaluation but does not work for unbalanced data sets [28]. In Section 5, we outline the following evaluation methods for text classification algorithms: F β Score [29], Matthews Correlation Coefficient (MCC) [30], receiver operating characteristics (ROC) [31], and area under the ROC curve (AUC) [32].
In Section 6, we talk about the limitations and drawbacks of the methods mentioned above. We also briefly compare the steps of pipeline including feature extractions, dimensionality reduction, classification techniques, and evaluation methods. The state-of-the-art techniques are compared in this section by many criteria such as architecture of their model, novelty of the work, feature extraction technique, corpus (the data set/s used), validation measure, and limitation of each work. Finding the best system for an application requires choosing a feature extraction method. This choice completely depends on the goal and data set of an application as some feature extraction techniques are not efficient for a specific application. For example, since GloVe is trained on Wikipedia and when used for short text messages like short message service (SMS), this technique does not perform as well as TF-IDF. Additionally, limited data points that this model cannot be trained as well as other techniques due to the small amount of data. The next step or in this pipeline, is a classification technique, where we briefly talk about the limitation and drawbacks of each technique.
In Section 7, we describe the text and document classification applications. Text classification is a major challenge in many domains and fields for researchers. Information retrieval systems [33] and search engine [34,35] applications commonly make use of text classification methods. Extending from these applications, text classification could also be used for applications such as information filtering (e.g., email and text message spam filtering) [36]. Next, we talk about adoption of document categorization in public health [37] and human behavior [38]. Another area that has been helped by text classification is document organization and knowledge management. Finally, we will discuss recommender systems which are extensively used in marketing and advertising.

Text Preprocessing
Feature extraction and pre-processing are crucial steps for text classification applications. In this section, we introduce methods for cleaning text data sets, thus removing implicit noise and allowing for informative featurization. Furthermore, we discuss two common methods of text feature extraction: Weighted word and word embedding techniques.

Text Cleaning and Pre-processing
Most text and document data sets contain many unnecessary words such as stopwords, misspelling, slang, etc. In many algorithms, especially statistical and probabilistic learning algorithms, noise and unnecessary features can have adverse effects on system performance. In this section, we briefly explain some techniques and methods for text cleaning and pre-processing text data sets.

Tokenization
Tokenization is a pre-processing method which breaks a stream of text into words, phrases, symbols, or other meaningful elements called tokens [39,40]. The main goal of this step is the investigation of the words in a sentence [40]. Both text classification and text mining require a parser which processes the tokenization of the documents, for example: sentence [41]: After sleeping for four hours, he decided to sleep for another four.

Stop Words
Text and document classification includes many words which do not contain important significance to be used in classification algorithms, such as {"a", "about", "above", "across", "after", "afterwards", "again",. . .}. The most common technique to deal with these words is to remove them from the texts and documents [42].

Capitalization
Text and document data points have a diversity of capitalization to form a sentence. Since documents consist of many sentences, diverse capitalization can be hugely problematic when classifying large documents. The most common approach for dealing with inconsistent capitalization is to reduce every letter to lower case. This technique projects all words in text and document into the same feature space, but it causes a significant problem for the interpretation of some words (e.g., "US" (United States of America) to "us" (pronoun)) [43]. Slang and abbreviation converters can help account for these exceptions [44].

Slang and Abbreviation
Slang and abbreviation are other forms of text anomalies that are handled in the pre-processing step. An abbreviation [45] is a shortened form of a word or phrase which contain mostly first letters form the words, such as SVM which stands for Support Vector Machine.
Slang is a subset of the language used in informal talk or text that has different meanings such as "lost the plot", which essentially means that they've gone mad [46]. A common method for dealing with these words is converting them into formal language [47].

Noise Removal
Most of the text and document data sets contain many unnecessary characters such as punctuation and special characters. Critical punctuation and special characters are important for human understanding of documents, but it can be detrimental for classification algorithms [48].

Syntactic N-Gram
In [58], syntactic n-grams are discussed which is defined by paths in syntactic dependency or constituent trees rather than the linear structure of the text.

Weighted Words
The most basic form of weighted word feature extraction is TF, where each word is mapped to a number corresponding to the number of occurrences of that word in the whole corpora. Methods that extend the results of TF generally use word frequency as a boolean or logarithmically scaled weighting. In all weight words methods, each document is translated to a vector (with length equal to that of the document) containing the frequency of the words in that document. Although this approach is intuitive, it is limited by the fact that particular words that are commonly used in the language may dominate such representations.

Bag of Words (BoW)
The bag-of-words model (BoW model) is a reduced and simplified representation of a text document from selected parts of the text, based on specific criteria, such as word frequency.
The BoW technique is used in several domains such as computer vision, NLP, Bayesian spam filters, as well as document classification and information retrieval by Machine Learning.
In a BoW, a body of text, such as a document or a sentence, is thought of like a bag of words. Lists of words are created in the BoW process. These words in a matrix are not sentences which structure sentences and grammar, and the semantic relationship between these words are ignored in their collection and construction. The words are often representative of the content of a sentence. While grammar and order of appearance are ignored, multiplicity is counted and may be used later to determine the focus points of the documents.
Here is an example of BoW: Document "As the home to UVA's recognized undergraduate and graduate degree programs in systems engineering. In the UVA Department of Systems and Information Engineering, our students are exposed to a wide range of range" Bag-of-Words (BoW) {"As", "the", "home", "to", "UVA's", "recognized", "undergraduate", "and", "graduate", "degree", "program", "in", "systems", "engineering", "in", "Department", "Information","students", " ","are", "exposed", "wide", "range" } Bag0of-words models encode every word in the vocabulary as one-hot-encoded vector e.g., for the vocabulary of size |Σ|, each word is represented by a |Σ| dimensional sparse vector with 1 at index corresponding to the word and 0 at every other index. As vocabulary may potentially run into millions, bag-of-word models face scalability challenges (e.g., "This is good" and "Is this good" have exactly the same vector representation). The technical problem of the bag-of-word is also the main challenge for the computer science and data science community.
Term frequency, also called bag-of-words, is the simplest technique of text feature extraction. This method is based on counting the number of words in each document and assigning it to the feature space.

Term Frequency-Inverse Document Frequency
K. Sparck Jones [59] proposed Inverse Document Frequency (IDF) as a method to be used in conjunction with term frequency in order to lessen the effect of implicitly common words in the corpus. IDF assigns a higher weight to words with either high or low frequencies term in the document. This combination of TF and IDF is well known as Term Frequency-Inverse document frequency (TF-IDF). The mathematical representation of the weight of a term in a document by TF-IDF is given in Equation (1).
Here N is the number of documents and d f (t) is the number of documents containing the term t in the corpus. The first term in Equation (1) improves the recall while the second term improves the precision of the word embedding [60]. Although TF-IDF tries to overcome the problem of common terms in the document, it still suffers from some other descriptive limitations. Namely, TF-IDF cannot account for the similarity between the words in the document since each word is independently presented as an index. However, with the development of more complex models in recent years, new methods, such as word embedding, have been presented that can incorporate concepts such as similarity of words and part of speech tagging.

Word Embedding
Even though we have syntactic word representations, it does not mean that the model captures the semantics meaning of the words. On the other hand, bag-of-word models do not respect the semantics of the word. For example, words "airplane", "aeroplane", "plane", and "aircraft" are often used in the same context. However, the vectors corresponding to these words are orthogonal in the bag-of-words model. This issue presents a serious problem to understanding sentences within the model. The other problem in the bag-of-word is that the order of words in the phrase is not respected. The n-gram does not solve this problem so a similarity needs to be found for each word in the sentence. Many researchers worked on word embedding to solve this problem. The Skip-gram and continuous bag-of-words (CBOW) models of [61] propose a simple single-layer architecture based on the inner product between two word vectors.
Word embedding is a feature learning technique in which each word or phrase from the vocabulary is mapped to a N dimension vector of real numbers. Various word embedding methods have been proposed to translate unigrams into understandable input for machine learning algorithms. This work focuses on Word2Vec, GloVe, and FastText, three of the most common methods that have been successfully used for deep learning techniques. Recently, the Novel technique of word representation was introduced where word vectors depend on the context of the word called "Contextualized Word Representations" or "Deep Contextualized Word Representations".

Word2Vec
T. Mikolov et al. [61,62] presented "word to vector" representation as an improved word embedding architecture. The Word2Vec approach uses shallow neural networks with two hidden layers, continuous bag-of-words (CBOW), and the Skip-gram model to create a high dimension vector for each word. The Skip-gram model dives a corpus of words w and context c [10]. The goal is to maximize the probability: where T refers to Text, and θ is parameter of p(c | w; θ). Figure 2 shows a simple CBOW model which tries to find the word based on previous words, while Skip-gram tries to find words that might come in the vicinity of each word. The weights between the input layer and output layer represent v × N [63] as a matrix of w.
This method provides a very powerful tool for discovering relationships in the text corpus as well as similarity between words. For example, this embedding would consider the two words such as "big" and "bigger" close to each other in the vector space it assigns them.
Projection Output Skip-gram CBOW Figure 2. The continuous bag-of-words (CBOW) architecture predicts the current word based on the context, and the Skip-gram predicts surrounding words based on the given current word [61].

Continuous Bag-of-Words Model
The continuous bag-of-words model is represented by multiple words for a given target of words. For example, the word "airplane" and "military" as context words for "air-force" as the target word. This consists of replicating the input to hidden layer connections β times which is the number of context words [61]. Thus, the bag-of-words model is mostly used to represent an unordered collection of words as a vector. The first thing to do is create a vocabulary, which means all the unique words in the corpus. The output of the shallow neural network will be w i that the task as "predicting the word given its context". The number of words used depends on the setting for the window size (common size is 4-5 words).

Continuous Skip-Gram Model
Another model architecture which is very similar to CBOW [61] is the continuous Skip-gram model, however this model, instead of predicting the current word based on the context, tries to maximize classification of a word based on another word in the same sentence. The continuous bag-of-words model and continuous Skip-gram model are used to keep syntactic and semantic information of sentences for machine learning algorithms.

Global Vectors for Word Representation (GloVe)
Another powerful word embedding technique that has been used for text classification is Global Vectors (GloVe) [11]. The approach is very similar to the Word2Vec method, where each word is presented by a high dimension vector and trained based on the surrounding words over a huge corpus. The pre-trained word embedding used in many works is based on 400,000 vocabularies trained over Wikipedia 2014 and Gigaword 5 as the corpus and 50 dimensions for word presentation. GloVe also provides other pre-trained word vectorizations with 100, 200, 300 dimensions which are trained over even bigger corpora, including Twitter content. Figure 3 shows a visualization of the word distances over a sample data set using the same t-SNE technique [64]. The objective function is as follows: where w i refers to the word vector of word i, and P ik denotes to the probability of word k to occur in the context of word i.

FastText
Many other word embedding representations ignore the morphology of words by assigning a distinct vector to each word [65]. Facebook AI Research lab released a novel technique to solve this issue by introducing a new word embedding method called FastText. Each word, w, is represented as a bag of character n-gram. For example, given the word "introduce" and n = 3, FastText will produce the following representation composed of character tri-grams: < in, int, ntr, tro, rod, odu, duc, uce, ce > Note that the sequence <int>, corresponding to the word here is different from the tri-gram "int" from the word introduce.
Suppose we have a dictionary of n-grams of size G, and given a word w which is associated as a vector representation z g to each n-gram g. The obtained scoring function [65] in this case is: where g w ∈ {1, 2, . . . , G} . Facebook published pre-trained word vectors for 294 languages which are trained on Wikipedia using FastText based on 300 dimension. The FastText used the Skip-gram model [65] with default parameters.

Contextualized Word Representations
Contextualized word representations are another word embedding technique which is based on the context2vec [66] technique introduced by B. McCann et al. The context2vec method uses bidirectional long short-term memory (LSTM). M.E. Peters et al. [67] built upon this technique to create the deep contextualized word representations technique. This technique contains both the main feature of word representation: (I) complex characteristics of word use (e.g., syntax and semantics) and (II) how these uses vary across linguistic contexts (e.g., to model polysemy) [67].
The main idea behind these word embedding techniques is that the resulting word vectors are learned from a bidirectional language model (biLM), which consist of both forward and backward LMs.
The forward LMs are as follows: The backward LMs are as follows: This formulation jointly maximizes the log-likelihood of the forward and backward directions as follows: where Θ x is the token representation and Θ x refers to the softmax layer. Then, ELMo is computed as a task-specific weighting for all biLM layers as follows: where h LM k,j is calculated by: where s task stands for softmax-normalized weights, and γ task is the scalar parameter.

Limitations
Although the continuous bag-of-words model and continuous Skip-gram model are used to keep syntactic and semantic information of per-sentences for machine learning algorithms, there remains the issue how to keep full meaning of coherent documents for machine learning.

Example:
Document: {"Maryam went to Paris on July 4th, 2018. She missed the independence day fireworks and celebrations. This day is a federal holiday in the United States commemorating the Declaration of Independence of the United States on July 4, 1776. The Continental Congress declared that the thirteen American colonies were no longer subject to the monarch of Britain and were now united, free, and independent states. She wants to stay in the country for next year and celebrate with her friends."} Sentence level of this document: S1: {"Maryam went to Paris on July 4th, 2018."} S2: {"She missed the independence day fireworks and celebrations."} S3: {"This day is a federal holiday in the United States commemorating the Declaration of Independence of the United States on July 4, 1776."} S4: {"The Continental Congress declared that the thirteen American colonies were no longer subject to the monarch of Britain and were now united, free, and independent states."} S5: {"She has a plan for next year to stay in the country and celebrate with her friends."} Limitation: Figure 4 shows how the feature extraction fails for per-sentence level. The purple color shown in figure is the brief history of "This day". Furthermore, "This day" refers to "July 4th". In S5, "She" refers to the S1 "Maryam".

Dimensionality Reduction
Text sequences in term-based vector models consist of many features. Thus, time complexity and memory consumption are very expensive for these methods. To address this issue, many researchers use dimensionality reduction to reduce the size of feature space. In this section, existing dimensionality reduction algorithms are discussed in detail.

Principal Component Analysis (PCA)
Principal component analysis (PCA) is the most popular technique in multivariate analysis and dimensionality reduction. PCA is a method to identify a subspace in which the data approximately lies [68]. This means finding new variables that are uncorrelated and maximizing the variance to "preserve as much variability as possible" [69].
Suppose a data set x (i) ; i = 1, ..., m is given and x (i) ∈ R n for each i (n m). The jth column of matrix X is vector, x j that is the observations on the jth variable. The linear combination of x j s can be written as: where a is a vector of constants a 1 , a 2 , ..., a m . The variance of this linear combination can be given as: where S is the sample co-variance matrix. The goal is to find the linear combination with maximum variance. This translates into maximizing a T Sa − λ(a T a − 1), where λ is a Lagrange multiplier.
PCA can be used as a pre-processing tool to reduce the dimension of a data set before running a supervised learning algorithm on it (x (i) s as inputs). PCA is also a valuable tool as a noise reduction algorithm and can be helpful in avoiding the over-fitting problem [70]. kernel principal component analysis (KPCA) is another dimensionality reduction method that generalizes linear PCA into the nonlinear case by using the kernel method [71].

Independent Component Analysis (ICA)
Independent component analysis (ICA) was introduced by H. Jeanny [72]. This technique was then further developed by C. Jutten and J. Herault [73]. ICA is a statistical modeling method where the observed data are expressed as a linear transformation [74]. Assume that 4n linear mixtures (x 1 , x 2 , . . . , x n ) are observed where independent components: x j = a j1 s 1 + a j2 s 2 + . . . + a jn s n ∀j (13) The vector-matrix notation is written as: Denoting them by a i , the model can also be written [75] as follows:

Linear Discriminant Analysis (LDA)
LDA is a commonly used technique for data classification and dimensionality reduction [76]. LDA is particularly helpful where the within-class frequencies are unequal and their performances have been evaluated on randomly generated test data. Class-dependent and class-independent transformation are two approaches to LDA in which the ratio of between class variance to within class variance and the ratio of the overall variance to within class variance are used respectively [77].
Let x i ∈ R d which be d-dimensional samples and y i ∈ {1, 2, ..., c} be associated target or output [76], where n is the number of documents and c is the number of categories. The number of samples in each class is calculated as follows: where The generalization between the class scatter matrix is defined as follows: Respect to c − 1 projection vector of w i that can be projected into W matrix: Thus, the µ (mean) vector and S matrices (scatter matrices) for the projected to lower dimension as follows: If the projection is not scalar (c − 1 dimensions), the determinant of the scatter matrices will be used as follows: From the fisher discriminant analysis (FDA) [76,78], we can re-write the equation as:

Non-Negative Matrix Factorization (NMF)
Non-negative matrix factorization (NMF) or non-negative matrix approximation has been shown to be a very powerful technique for very high dimensional data such as text and sequences analysis [79]. This technique is a promising method for dimension reduction [80]. In this section, a brief overview of NMF is discussed for text and document data sets. Given a non-negative n × m in matrix V is an approximation of: where W = R n×r and H = R r×m . Suppose (n + m) r < nm, then the product W H can be regarded as a compressed form of the data in V. Then v i and h i are the corresponding columns of V and H. The computation of each corresponding column can be re-written as follows: The computational time of each iteration, as introduced by S. Tsuge et al. [80], can be written as follows: Thus, the local minimum of the objective function is calculated as follows: The maximization of the objective function can be re-written as follows: The objective function, given by the Kullback-Leibler [81,82] divergence, is defined as follows: This NMF-based dimensionality reduction contains the following 5 steps [80] (step VI is optional but commonly used in information retrieval: Extract index term after pre-processing stem like feature extraction and text cleaning as discussed in Section 2. Then we have n documents with m features; (II) Create n documents (d ∈ {d 1 , d 2 , . . . , d n }), where vector a ij = L ij × G i where L ij refers to local weights of i −th term in document j, and G i is global weights for document i; (III) Apply NMF to all terms in all documents one by one; (IV) Project the trained document vector into r-dimensional space; (V) Using the same transformation, map the test set into the r-dimensional space; (VI) Calculate the similarity between the transformed document vectors and a query vector.

Random Projection
Random projection is a novel technique for dimensionality reduction which is mostly used for high volume data set or high dimension feature spaces. Texts and documents, especially with weighted feature extraction, generate a huge number of features. Many researchers have applied random projection to text data [83,84] for text mining, text classification, and dimensionality reduction. In this section, we review some basic random projection techniques. As shown in Figure 5, the overview of random projection is shown.

Random Kitchen Sinks
The key idea of random kitchen sinks [85] is sampling via monte carlo integration [86] to approximate the kernel as part of dimensionality reduction. This technique works only for shift-invariant kernel: where shift-invariant kernel, which is an approximation kernel of: where D is the target number of samples, P(w) is a probability distribution, w stands for random direction, and w ∈ R F×D where F is the number of features and D is the target.
w Figure 5. The plot on the left shows how we generate random direction, and the plot on the right shows how we project the data set into the new space using complex numbers.

Johnson Lindenstrauss Lemma
William B. Johnson and Joram Lindenstrauss [87,88] proved that for any n point Euclidean space can be bounded in k = O( logn 2 ) for any u and v ∈ n and n ∈ R d : 1]. With x = u − v to the lower bound of the success probability.
Johnson Lindenstrauss Lemma Proof [89]: For any V sets of data point from n where V ∈ n and random variable w ∈ R k×d : If we let k = 16logn

Lemma 1 Proof [89]:
Let Ψ be a random variable with k degrees of freedom, then for ∈ [0, 1] We start with Markov's inequality [90]: where λ < 0.5 and using the fact of (1 Lemma 2 Proof [89]: Let w be a random variable of w ∈ R k×d and k < d, x is data points x ∈ R d then for any ∈ [0, 1] : In Equation (50), 1 √ k wx is the random approximation value and x = wx, so we can rewrite the where we can prove Equation (51) by using Equation (45):

Autoencoder
An autoencoder is a type of neural network that is trained to attempt to copy its input to its output [91]. The autoencoder has achieved great success as a dimensionality reduction method via the powerful reprehensibility of neural networks [92]. The first version of autoencoder was introduced by D.E. Rumelhart et al. [93] in 1985. The main idea is that one hidden layer between input and output layers has fewer units [94] and could thus be used to reduce the dimensions of a feature space. Especially for texts, documents, and sequences that contain many features, using an autoencoder could help allow for faster, more efficient data processsing.

General Framework
As shown in Figure 6, the input and output layers of an autoencoder contain n units where x = R n , and hidden layer Z contains p units with respect to p < n [95]. For this technique of dimensionality reduction, the dimensions of the final feature space are reduced from n → p. The encoder representation involves a sum of the representation of all words (for bag-of-words), reflecting the relative frequency of each word [96]: where h(.) is an element-wise non-linearity such as the sigmoid (Equation (79)).
X X Z Decoder Encoder Figure 6. This figure shows how a simple autoencoder works. The model depicted contains the following layers: Z is code and two hidden layers are used for encoding and two are used for decoding.

Conventional Autoencoder Architecture
A convolutional neural networks (CNN)-based autoencoder can be divided into two main steps [97] (encoding and decoding).
where F ∈ {F (1) n , } which is a convolutional filter, with convolution among an input volume defined by I = {I 1 , · · · , I D } which learns to represent input combining non-linear functions: where b (1) m is the bias, and the number of zeros we want to pad the input with is such that: dim(I) = dim(decode(encode(I))). Finally, the encoding convolution is equal to: The decoding convolution step produces n feature maps z m=1,...,n . The reconstructed resultsÎ is the result of the convolution between the volume of feature maps Z = {z i=1 } n and this convolutional filters volume F (2) [97][98][99] where Equation (58) shows the decoding convolution with I dimensions. Input's dimensions are equal to the output's dimensions.

Recurrent Autoencoder Architecture
A recurrent neural network (RNN) is a natural generalization of feedforward neural networks to sequences [100]. Figure 7 illustrate recurrent autoencoder architecture. A standard RNN compute the econding as a sequences of output by iteration: where x is inputs (x 1 , ..., x T ) and y refers to output (y 1 , ..., y T ). A multinomial distribution (1-of-K coding) can be output using a softmax activation function [101]: By combining these probabilities, we can compute the probability of the sequence x as: ...

T-distributed Stochastic Neighbor Embedding (t-SNE)
T-SNE is a nonlinear dimensionality reduction method for embedding high-dimensional data. This method is mostly commonly used for visualization in a low-dimensional feature space [64], as shown in Figure 8. This approach is based on G. Hinton and S. T. Roweis [102]. SNE works by converting the high dimensional Euclidean distances into conditional probabilities which represent similarities [64]. The conditional probability p j|i is calculated by: where σ i is the variance of the centered on data point x i . The similarity of y j to y i is calculated as follows: The cost function C is as follows: where KL(P i |Q i ) is the Kullback-Leibler divergence [103], which is calculated as: The gradient update with a momentum term is as follows: where η is the learning rate, γ (t) refers to the solution at iteration t, and α(t) indicates momentum at iteration t. Now we can re-write symmetric SNE in the high-dimensional space and a joint probability distribution, Q, in the low-dimensional space as follows [64]: in the high-dimensional space p ij is: The gradient of symmetric S is as follows:

Existing Classification Techniques
In this section, we outline existing text and document classification algorithms. First, we describe the Rocchio algorithm which is used for text classification. Then, we address two popular techniques in ensemble learning algorithms: Boosting and bagging. Some methods, such as logistic regression, Naïve Bayes, and k-nearest neighbor, are more traditional but still commonly used in the scientific community. Support vector machines (SVMs), especially kernel SVMs, are also broadly used as a classification technique. Tree-based classification algorithms, such as decision tree and random forests are fast and accurate for document categorization. We also describe neural network based algorithms such as deep neural networks (DNN), CNN, RNN, deep belief network (DBN), hierarchical attention networks (HAN), and combination techniques.

Rocchio Classification
The Rocchio algorithm was first introduced by J.J. Rocchio [104] in 1971 as method of using relevance feedback to query full-text databases. Since then, many researchers have addressed and developed this technique for text and document classification [105,106]. This classification algorithm uses TF-IDF weights for each informative word instead of boolean features. Using a training set of documents, the Rocchio algorithm builds a prototype vector for each class. This prototype is an average vector over the training documents' vectors that belong to a certain class. It then assigns each test document to the class with the maximum similarity between the test document and each of the prototype vectors [107]. The average vector computes the centroid of a class c (center of mass of its members): where D c is the set of documents in D that belongs to class c and v d is the weighted vector representation of document d. The predicted label of document d is the one with the smallest Euclidean distance between the document and the centroid: Centroids can be normalized to unit-length as follows: Therefore, the label of test documents can be obtained as follows: Limitation of Rocchio Algorithm The Rocchio algorithm for text classifcation contains many limitations such as the fact that the user can only retrieve a few relevant documents using this model [108]. Furthermore, this algorithms' results illustrate by taking semantics into consideration [109].

Boosting and Bagging
Voting classification techniques, such as bagging and boosting, have been successfully developed for document and text data set classification [110]. While boosting adaptively changes the distribution of the training set based on the performance of previous classifiers, bagging does not look at the previous classifier [111].

Boosting
The boosting algorithm was first introduced by R.E. Schapire [112] in 1990 as a technique for boosting the performance of a weak learning algorithm. This technique was further developed by Freund [113,114]. Figure 9 shows how a boosting algorithm works for 2D data sets, as shown we have labeled the data, then trained by multi-model architectures (ensemble learning). These developments resulted in the AdaBoost (Adaptive Boosting) [115]. Suppose we construct D t such that D 1 (i) = 1 m given D t and h t : where Z t refers to the normalization factor and α t is as follows:

Error Dataset
Train Test Train Test ... Figure 9. This figure is the boosting technique architecture.

Error
As shown in Algorithm 1, training set S of size m, inducer τ and integer N as input. Then this algorithm find the weights of each x j , and finally, the output is the optimal classifier (C * ).

Algorithm 1 The AdaBoost method
input : training set S of size m, inducer τ, integer N if i > 1 2 then set S' to a bootstrap sample from S with weight 1 for all instance and go top Normalize weights of instances endfor The final classifier formulation can be written as:

Bagging
The bagging algorithm was introduced by L. Breiman [116] in 1996 as a voting classifier method. The algorithm is generated by different bootstrap samples [111]. A bootstrap generates a uniform sample from the training set. If N bootstrap samples B 1 , B 2 , . . . , B N have been generated, then we have N classifiers (C) which C i is built from each bootstrap sample B i . Finally, our classifier C contain or generated from C 1 , C 2 , ..., C N whose output is the class predicted most often by its sub-classifiers, with ties broken arbitrarily [111,116]. Figure 10 shows a simple bagging algorithm which trained N models. As shown in Algorithm 2, We have training set S which is trained and find the best classifier C.

Dataset
Train N models Test Test Figure 10. This figure shows a simple model of the bagging technique.

Algorithm 2 Bagging
input : training set S, inducer τ, integer N

Limitation of Boosting and Bagging
Boosting and bagging methods also have many limitations and disadvantages, such as the computational complexity and loss of interpretability [117], which means that the feature importance could not be discovered by these models.

Logistic Regression
One of the earliest methods of classification is logistic regression (LR). LR was introduced and developed by statistician David Cox in 1958 [118]. LR is a linear classifier with decision boundary of θ T x = 0. LR predicts probabilities rather than classes [119,120].

Basic Framework
The goal of LR is to train from the probability of variable Y being 0 or 1 given x. Let us have text data which is X ∈ R n×d . If we have binary classification problems, the Bernoulli mixture models function should be used [121] as follows: , and sigm(.) is a sigmoid function which is defined as shown in Equation (79).

Combining Instance-Based Learning and LR
The LR model specifies the probability of binary output y i = {0, 1} given the input x i . we can consider posterior probability as: where: where p is the likelihood ratio it could be re-written as: with respect to: To obey the basic principle underlying instance-based learning (IBL) [122], the classifier should be a function of the distance δ i . p will be large if δ i → 0 then y i = +1, and small for y i = −1. p should be close to 1 if δ i → ∞; then, neither in favor of y 0 = +1 nor in favor of y 0 = −1, so the parameterized function is as follows: Finally, where k(x 0 , x i ) is similarity measure.

Multinomial Logistic Regression
Multinomial (or multilabeled) logistic classification [123] uses the probability of x belonging to class i (as defined in Equation (87)) where θ (i) is the weight vector corresponding to class i. For binary classification (m = 2) which is known as a basic LR, but for multinomial logistic regression (m > 2) is usually uses the so f tmax function.
The normalization function is: In a classification task as supervised learning context, the component of θ is calculated from the subset of the training data D which belongs to class i where i ∈ {1, . . . , n}. To perform maximum likelihood (ML) estimation of θ, we need to maximize the log-likelihood function as follows: The adoption of a maximum a posteriori (MAP) estimates as follows:

Limitation of Logistic Regression
Logistic regression classifier works well for predicting categorical outcomes. However, this prediction requires that each data point be independent [124] which is attempting to predict outcomes based on a set of independent variables [125]

Naïve Bayes Classifier
Naïve Bayes text classification has been widely used for document categorization tasks since the 1950s [126,127]. The Naïve Bayes classifier method is theoretically based on Bayes theorem, which was formulated by Thomas Bayes between 1701-1761 [128,129]). Recent studies have widely addressed this technique in information retrieval [130]. This technique is a generative model, which is the most traditional method of text categorization. We start with the most basic version of NBC which was developed by using TF (bag-of-word), a feature extraction technique which counts the number of words in documents.

High-Level Description of Naïve Bayes Classifier
If the number of documents (n) fit into k categories where k ∈ {c 1 , c 2 , ..., c k }, the predicted class as output is c ∈ C. The Naïve Bayes algorithm can be described as follows: where d is document and c indicates classes.
This model is used as baseline of many papers which is word-level of Naïve Bayes classifier [3,131] as follows:

Multinomial Naïve Bayes Classifier
If the number of documents (n) fit into k categories where k ∈ {c 1 , c 2 , ..., c k } the predicted class as output is c ∈ C. The Naïve Bayes algorithm can be written as: where n wd is denoted to the number of times word w occurs in document, and P(w|c) is the probability of observing word w given class c [132]. P(w|c) is calculated as:

Naïve Bayes Classifier for Unbalanced Classes
One of the limitations of NBC is that the technique performs poorly on data sets with unbalanced classes [133]. Eibe Frank and Remco R. Bouckaert [132] developed a method for introducing normalization in each class by Equation (96) and then uses the centroid classifier [22] in NBC for unbalanced classes. The centroid c c for class c is given in Equation (97).
The scoring function is defined as: So log of multinomial Naïve Bayes classifier can be calculated as: Using Equations (95) and (96), and if α = 1 we can rewrite: with respect to: For text data sets and log(x + 1) ≈ x and x << 1 [132]. In this technique of NBC, the experimental results is very similar to the centroid classifier [22].

Limitation of Naïve Bayes Algorithm
Naïve Bayes algorithm also has several limitations. NBC makes a strong assumption about the shape of the data distribution [134,135]. NBC is also limited by data scarcity for which any possible value in feature space, a likelihood value must be estimated by a frequentist [136].

K-Nearest Neighbor
The k-nearest Neighbors algorithm (KNN) is a non-parametric technique used for classification. This method is used for text classification applications in many research domains [137] in past decades.

Basic Concept of KNN
Given a test document x, the KNN algorithm finds the k nearest neighbors of x among all the documents in the training set, and scores the category candidates based the class of k neighbors. The similarity of x and each neighbor's document could be the score of the category of the neighbor documents. Multiple KNN documents may belong to the same category; in this case, the summation of these scores would be the similarity score of class k with respect to the test document x. After sorting the score values, the algorithm assigns the candidate to the class with the highest score from the test document x [137]. Figure 11 illustrates KNN architecture, but for simplicity, this figure is designed by a 2D data set (similar and with higher dimensional space like the text data set). The decision rule of KNN is: where S refers to score value with respect to S(x, C j ), the score value of candidate i to class of j, and output of f (x) is a label to the test set document.
Class 1 Class 2 Class 3 xi Figure 11. A architecture of k-nearest Neighbor (KNN) model for the 2D data set and three classes.

Weight Adjusted K-Nearest Neighbor Classification
The weight adjusted k-nearest neighbor classification (WAKNN) is a version of KNN which tries to learn the weight vectors for classification [138]. The weighted cosine measure [139] is calculated as follows: where T refers to the set of words, and x t and y t are TF, as discussed in Section 2. For the training model (d ∈ D), let N d = {n 1 , n 2 , . . . , n k } be the set of k-nearest Neighbors of d. Given N d , the similarity sum of d neighbors that belong to class c is defined as follows: Total similarity is calculated as follows: The contribution of d is defined in terms of S c of classes c and T as follows: where cont(d) stands for contribution(d)

Limitation of K-Nearest Neighbor
KNN is a classification method that is easy to implement and adapts to any kind of feature space. This model also naturally handles multi-class cases [140,141]. However, KNN is limited by data storage constraints for large search problems to find nearest neighbors. Additionally, the performance of KNN is dependent on finding a meaningful distance function, thus making this technique a very data dependent algorithm [142,143].

Support Vector Machine (SVM)
The original version of SVM was developed by Vapnik and Chervonenkis [144] in 1963. B.E. Boser et al. [145] adapted this version into a nonlinear formulation in the early 1990s. SVM was originally designed for binary classification tasks. However, many researchers work on multi-class problems using this dominate technique [146]. The Figure 12 indicates the linear and non-linear classifier which is used for 2 − dimension datasets.

Binary-Class SVM
In the context of text classification, let x 1 , x 2 , ..., x l be training examples belonging to one class X, where X is a compact subset of R N [21]. Then we can formulate a binary classifier as follows: subject to: If w and p solve this problem, then the decision function is given by:

Multi-Class SVM
Since SVMs are traditionally used for the binary classification, we need to generate a Multiple-SVM (MSVM) [147] for multi-class problems. One-vs-One is a technique for multi-class SVM that builds N(N − 1) classifiers as follows: The natural way to solve the k-class problem is to construct a decision function of all k classes at once [148,149]. In general, multi-class SVM is an optimization problem of the following form: where (x i , y i ) represent the training data points such that (x i , y i ) ∈ D, C is the penalty parameter, ζ is a slack parameter, and k stands for the class. Another technique of multi-class classification using SVM is All-vs-One. Feature extraction via SVM generally uses one of two methods: Word sequences feature extracting [150] and TF-IDF. But for an unstructured sequence such as RNA and DNA sequences, string kernel is used. However, string kernel can be used for a document categorization [151].

String Kernel
Text classification has also been studied using string kernel [151]. The basic idea of string kernel (SK) is using Φ(.) to map the string in the feature space.
Spectrum kernel as part of SK has been applied to many different applications, including text, DNA, and protein classification [152,153]. The basic idea of Spectrum kernel is counting the number of times a word appears in string x i as a feature map where defining feature maps from x → R l k .
The feature map Φ i (x) is generated by the sequence x i and kernel defines as follows: The main limitation of SVM when applied to string sequence classification is time complexity [154]. The features are generated using dictionary size Σ and F is the number of features and bounded by Equation (115). The kernel calculation is similar with SP and uses Equation (116), and finally normalizes the kernel using Equation (117). < where two sequences, u s 1 i and u s 2 j , are lengths of s 1 and s 2 respectively.

Stacking Support Vector Machine (SVM)
Stacking SVM is a hierarchical classification method used for category tree structure based on a top-down level-based approach [155]. This technique provides a hierarchical model of individual SVM classifiers, and thus generally produces more accurate results than single-SVM models [156]. As shown in the Figure 13 Figure 13. Hierarchical classification method.

Multiple Instance Learning (MIL)
Multiple instance learning (MIL) is a supervised learning method [157] and is typically formulated as one of two SVM-based methods (mi-SVM and MI-SVM) [158]. MIL takes in a set of labeled bags as input instead of instances. A bag is labeled positive if there is at least one instance in it with a positive label, and labeled negative if all instances of it are negative. Then, the learner tries to infer a concept that label individual instances correctly [157]. In statistical pattern recognition, it is assumed that a training set of labeled patterns is available where each pair (x i , y i ) ∈ R d × Y has been generated from an unknown distribution independently. The goal is to find a classifier from patterns to labels i.e., f : R d → Y. In MIL, the algorithm assumes the input is available as a set of input patterns x 1 , ..., x n grouped into bags B 1 , ..., B m where B I = {x i : i ∈ I} for the given index sets I ⊆ {1, ..., n}. Each bag B I is associated with label Y I where Y I = −1 if y i = −1 for all i ∈ I and Y I = 1 if there is at least one instance x i ∈ B I with positive label [158]. The relationship between instance labels y i and bag labels Y I can be expressed as Y I = max i∈I y i or a set of linear constraints: The discriminant function f : X → R is called MI-separating with respect to a multiple-instance data set if sgn max i∈I f (x i ) = Y I for all bags B I holds.
4.6.6. Limitation of Support Vector Machine (SVM) SVM has been one of the most efficient machine learning algorithms since its introduction in the 1990s [159]. However, the SVM algorithms for text classification are limited by the lack of transparency in results caused by a high number of dimensions. Due to this, it cannot show the company score as a parametric function based on financial ratios nor any other functional form [159]. A further limitation is a variable financial ratios rate [160].

Decision Tree
One earlier classification algorithm for text and data mining is decision tree [161]. Decision tree classifiers (DTCs) are used successfully in many diverse areas for classification [162]. The structure of this technique is a hierarchical decomposition of the data space [7,161]. Decision tree as classification task was introduced by D. Morgan [163] and developed by J.R. Quinlan [164]. The main idea is creating a tree based on the attribute for categorized data points, but the main challenge of a decision tree is which attribute or feature could be in parents' level and which one should be in child level. To solve this problem, De Mántaras [165] introduced statistical modeling for feature selection in tree. For a training set containing p positive and n negative: Choose attribute A with k distinct value, divides the training set E into subsets of {E 1 , E 2 , . . . , E k }. The expect entropy (EH) remain after trying attribute A (with branches i = 1, 2, . . . , k): Information gain (I) or reduction in entropy for this attribute is : Choose the attribute with largest information gain as parent's node.

Limitation of Decision Tree Algorithm
The decision tree is a very fast algorithm for both learning and prediction; but it is also extremely sensitive to small perturbations in the data [166], and can be easily overfit [167]. These effects can be negated by validation methods and pruning, but this is a grey area [166]. This model also has problems with out-of-sample prediction [168].

Random Forest
Random forests or random decision forests technique is an ensemble learning method for text classification. This method, which used t tree as parallel, was introduced by T. Kam Ho [169] in 1995. As shown in Figure 14, the main idea of RF is generating random decision trees. This technique was further developed in 1999 by L. Breiman [170], who found convergence for RF as margin measures (mg(X, Y)) as follows: where I(.) refers to indicator function.
Voting for classification X Tree 1 Tree 2 Tree t k Figure 14. Random forest.

Voting
After training all trees as forest, predictions are assigned based on voting [171] as follows: such that r ij + r ji = 1

Limitation of Random Forests
Random forests (i.e., ensembles of decision trees) are very fast to train for text data sets in comparison to other techniques such as deep learning, but quite slow to create predictions once trained [172]. Thus, in order to achieve a faster structure, the number of trees in forest must be reduced, as more trees in forest increases time complexity in the prediction step.

Conditional Random Field (CRF)
CRF is an undirected graphical model, as shown in Figure 15. CRFs are essentially a way of combining the advantages of classification and graphical modeling that combine the ability to compactly model multivariate data, and the ability to leverage a high dimensional features space for prediction [173] (this model is very powerful for text data due to high feature space). CRFs state the conditional probability of a label sequence Y given a sequence of observation X i.e., P(Y|X). CRFs can incorporate complex features into an observation sequence without violating the independence assumption by modeling the conditional probability of the label sequence rather than the joint probability P(X, Y) [174,175]. Clique (i.e., fully connected subgraph) potential is used for computing P(X|Y). With respect to the potential function for each clique in the graph, the probability of a variable configuration corresponds to the product of a series of a non-negative potential functions.
The value computed by each potential function is equivalent to the probability of the variables in the corresponding clique for a particular configuration [174]. That is: where Z is the normalization term. The conditional probability P(X|Y) can be formulated as: Given the potential function (ψ(t, y t−1 , y t , X) = exp(w. f (t, y t−1 , y t , X))), the conditional probability can be rewritten as: where w is the weight vector associated with a feature vector computed by f . With regards to CRF, the most evident disadvantage of CRF is the high computational complexity of the training step [176], especially for text data sets due to high feature space. Furthermore, this algorithm does not perform with unseen words (i.e., with words that were not present in the training data sample) [177].

Deep Learning
Deep learning models have achieved state-of-the-art results across many domains, including a wide variety of NLP applications. Deep learning for text and document classification includes three basic architectures of deep learning in parallel. We describe each individual model in detail below.

Deep Neural Networks
Deep neural networks (DNN) are designed to learn by multi-connection of layers that every single layer only receives the connection from previous and provides connections only to the next layer in a hidden part [2]. Figure 16 depicts the structure of a standard DNN. The input consists of the connection of the input feature space (as discussed in Section 2) with the first hidden layer of the DNN. The input layer may be constructed via TF-IDF, word embedding, or some other feature extraction method. The output layer is equal to the number of classes for multi-class classification or only one for binary classification. In multi-class DNNs, each learning model is generated (number of nodes in each layer and the number of layers are completely randomly assigned). The implementation of DNN is a discriminative trained model that uses a standard back-propagation algorithm using sigmoid (Equation (129)), ReLU [178] (Equation (130)) as an activation function. The output layer for multi-class classification should be a So f tmax function (as shown in Equation (131)).
∀ j ∈ {1, . . . , K} Given a set of example pairs (x, y),x ∈ X, y ∈ Y, the goal is to learn the relationship between these input and target spaces using hidden layers. In text classification applications, the input is a string which is generated via vectorization of the raw text data.

Hidden Layer
Output Layer Input Layer

Recurrent Neural Network (RNN)
Another neural network architecture that researchers have used for text mining and classification is recurrent neural network (RNN) [179,180]. RNN assigns more weights to the previous data points of a sequence. Therefore, this technique is a powerful method for text, string, and sequential data classification. A RNN considers the information of previous nodes in a very sophisticated method which allows for better semantic analysis of a data set's structure. RNN mostly works by using LSTM or GRU for text classification, as shown in Figure 17 which contains input layer (word embedding), hidden layers, and finally output layer. This method can be formulated as: where x t is the state at time t and u t refers to the input at step t. More specifically, we can use weights to formulate Equation (132), parameterized by: where W rec refers to recurrent matrix weight, W in refers to input weights, b is the bias, and σ denotes an element-wise function. Figure 17 illustrates an extended RNN architecture. Despite the benefits described above, RNN is vulnerable to the problems of vanishing gradient and exploding gradient when the error of the gradient descent algorithm is back propagated through the network [181]. LSTM was introduced by S. Hochreiter and J. Schmidhuber [182], and has since been augmented by many research scientists [183].
LSTM is a special type of RNN that addresses these problems by preserving long term dependency in a more effective way in comparison to the basic RNN. LSTM is particularly useful with respect to overcoming the vanishing gradient problem [184]. Although LSTM has a chain-like structure similar to RNN, LSTM uses multiple gates to carefully regulate the amount of information that is allowed into each node state. Figure 18 shows the basic cell of an LSTM model. A step-by-step explanation of a LSTM cell is as follows: where Equation (134) represents the input gate, Equation (135) represents the candid memory cell value, Equation (136) defines forget-gate activation, Equation (137) calculates the new memory cell value, and Equations (138) and (139) define the final output gate value. In the above description, each b represents a bias vector, each W represent a weight matrix, and x t represents input to the memory cell at time t. Furthermore, i,c, f ,o indices refer to input, cell memory, forget and output gates respectively. Figure 18 shows a graphical representation of the structure of these gates. A RNN can be biased when later words are more influential than earlier ones. Convolutional neural network (CNN) models (discussed in Section 4.10.3) were introduced to overcome this bias by deploying a max-pooling layer to determine discriminative phrases in text data [6].

Gated Recurrent Unit (GRU)
GRUs are a gating mechanism for RNN formulated by J. Chung et al. [185] and K. Cho et al. [101]. GRUs are a simplified variant of the LSTM architecture. However, a GRU differs from LSTM because it contains two gates and a GRU does not possess internal memory (i.e., the C t−1 in Figure 18). Furthermore, a second non-linearity is not applied (i.e., tanh in Figure 18). A step-by-step explanation of a GRU cell is as follows: where z t refers to the update gate vector of t, x t stands for input vector, W, U, and b represent parameter matrices/vectors. The activation function (σ g ) is either a sigmoid or ReLU and can be formulated as follow:r where r t stands for reset gate vector of t, z t is update gate vector of t.
where h t is output vector of t, and σ h indicates the hyperbolic tangent function.

Convolutional Neural Networks (CNN)
A convolutional neural network (CNN) is a deep learning architecture that is commonly used for hierarchical document classification [6,186]. Although originally built for image processing, CNNs have also been effectively used for text classification [27,187]. In a basic CNN for image processing, an image tensor is convolved with a set of kernels of size d × d. These convolution layers are called feature maps and can be stacked to provide multiple filters on the input. To reduce the computational complexity, CNNs use pooling to reduce the size of the output from one layer to the next in the network. Different pooling techniques are used to reduce outputs while preserving important features [188].
The most common pooling method is max pooling where the maximum element in the pooling window is selected. In order to feed the pooled output from stacked featured maps to the next layer, the maps are flattened into one column. The final layers in a CNN are typically fully connected.
In general, during the back-propagation step of a convolutional neural network, both the weights and the feature detector filters are adjusted. A potential problem that arises when using CNN for text classification is the number of 'channels', Σ (size of the feature space). While image classification application generally have few channels (e.g., only 3 channels of RGB), Σ may be very large (e.g., 50 K) for text classification applications [189], thus resulting in very high dimensionality. Figure 19 illustrate the CNN architecture for text classification which contains word embedding as input layer 1D convolutional layers, 1D pooling layer, fully connected layers, and finally output layer.

Deep Belief Network (DBN)
A deep belief network (DBN) is a deep learning structure that is superposed by restricted Boltzmann machines (RBMs) [1]. A RBM is a generative artificial neural network which could learn probability distribution over samples. Contrastive divergence (CD) [190] is a training technique used for RBMs [191,192].
The energy function is as follows: where a i is visible units and b i refers to hidden units in matrix notation. This expression can be simplified as: Given a configuration of the hidden units h is defined as follows: For Bernoulli, the logistic function for visible units is replaced as follows: The update function with gradient descent is as follows:

Hierarchical Attention Networks (HAN)
One of the successful deep architecture for text and document classification is hierarchical attention networks (HAN). This technique was introduced by Z. Yang et al. [193] and S.P. Hongsuck et al. [194]. The structure of a HAN focuses on the document-level classification which a document has L sentences and each sentence contains T i words, where w it with t [1, T] represents the words in the ith sentence. HAN architecture is illustrated in Figure 20, where the lower level contains word encoding and word attention and the upper level contains sentence encoding and sentence attention.

Combination Techniques
Many researchers combine or concatenate standard deep learning architectures in order to develop novel techniques with more robust and accurate architectures for classification tasks. In this sub-section, we describe recent and popular deep learning architectures and structure.

Random Multimodel Deep Learning (RMDL)
Random multimodel deep learning (RMDL) was introduced by K. Kowsari et al. [4,5] as a novel deep learning technique for classification. RMDL can be used in any kind of data set for classification. An overview of this technique is shown in Figure 21 which illustrates the architecture using multi-DNN, deep CNN, and deep RNN. The number of layers and nodes for all of these deep learning multi-models are generated randomly (e.g., 9 random models in RMDL constructed from 3 CNNs, 3 RNNs, and 3 DNNs, all of which are unique due to random creation).
where n is the number of random models, and y ij is the output prediction of model for data point i in model j (Equation (148) is used for binary classification, k ∈ {0 or 1}). The output space uses majority vote to calculate the final value ofŷ i . Therefore,ŷ i is given as follows: where n is the number of the random model, andŷ ij shows the prediction of the label of data point (e.g., document) of D i ∈ {x i , y i } for model j andŷ i,j is defined as follows:  After all the RDL models (RMDL) are trained, the final prediction is calculated using majority vote on the output of these models. The main idea of using multi-model with different optimizers is that if one optimizer does not provide a good fit for a specific data set, the RMDL model with n random models (where some of them might use different optimizers) could ignore k models which are not efficient if and only if n > k. Using multi-techniques of optimizers (e.g., SGD, Adam, RMSProp, Adagrad, Adamax) helps the RMDL model be more suitable for any type of data sets. While we only used 2 optimizers (Adam and RMSProp) for evaluating the model in this research, the RMDL model can use any kind of optimizer. In this part, we describe common optimization techniques used in deep learning architectures.

Stochastic Gradient Descent (SGD) Optimizer:
The basic equation for stochastic gradient descent (SGD) [195] is shown in Equation (151). SGD uses a momentum on re-scaled gradient which is shown in Equation (152) for updating parameters.

RMSprop:
T. Tieleman and G. Hinton [196] introduced RMSprop as a novel optimizer which divides the learning rate for a weight by a running average of the magnitudes of recent gradients for that weight. The equation of the momentum method for RMSprop is as follows: RMSProp does not do bias correction, which causes significant problems when dealing with a sparse gradient.

Adam Optimizer
Adam is another stochastic gradient optimizer which uses only the first two moments of gradient (v and m, shown in Equations (155)- (158)) and calculate the average over them. It can handle non-stationary of the objective function as in RMSProp while overcoming the sparse gradient issue limitation of RMSProp [197].
where m t is the first moment and v t indicates second moment that both are estimated.m t = m t

Adagrad:
Adagrad is addressed in [198] as a novel family of sub-gradient methods which dynamically absorb knowledge of the geometry of the data to perform more informative gradient-based learning.
AdaGrad is an extension of SGD. In iteration k, the gradient is defined as: diagonal matrix: update rule:

Adadelta:
AdaDelta, introduced by M.D. Zeiler [199], uses the exponentially decaying average of g t as 2 nd moment of gradient. This method is an updated version of Adagrad which relies on only first order information. The update rule for Adadelta is: Hierarchical Deep Learning for Text (HDLTex) The primary contribution of the hierarchical deep learning for text (HDLTex) architecture is hierarchical classification of documents [2]. A traditional multi-class classification technique can work well for a limited number of classes, but performance drops with an increasing number of classes, as is present in hierarchically organized documents. In this hierarchical deep learning model, this problem was solved by creating architectures that specialize deep learning approaches for their level of the document hierarchy (e.g., see Figure 22). The structure of the HDLTex architecture for each deep learning model is as follows: All models were constructed using the following parameters: Batch Size = 128, learning parameters = 0.001, β 1 = 0.9, β 2 = 0.999, = 1e 08 , decay = 0.0, Dropout = 0.5 (DNN), and Dropout = 0.25 (CNN and RNN).
HDLTex uses the following cost function for the deep learning models evaluation: where is the number of levels, k indicates number of classes for each level, and Ψ refers to the number of classes in the child's level of the hierarchical model.

Other Techniques
In this section, we discuss other techniques of text classification that come from combining deep learning architectures. Recurrent convolutional neural networks (RCNN) is used for text classification [6,200]. RCNNs can capture contextual information with the recurrent structure and construct the representation of text using a CNN [6]. This architecture is a combination of RNN and CNN that leverages the advantages of both techniques in a model. C-LSTM is another technique of text and document classification that was introduced by C. Zhou et al. [201]. C-LSTM combines CNN with LSTM in order to learn phrase-level features using convolutional layers. This architecture feeds sequences of higher level representations into the LSTM to learn long-term dependent.

Limitation of Deep Learning
Model interpretability of deep learning (DL), especially DNN, has always been a limiting factor for use cases requiring explanations of the features involved in modelling and such is the case for many healthcare problems. This problem is due to scientists preferring to use traditional techniques such as linear models, Bayesian Models, SVM, decision trees, etc. for their works. The weights in a neural network are a measure of how strong each connection is between each neuron to find the important feature space. As shown in Figure 23, the more accurate model, the interpretability is lower which means the complex algorithms such as deep learning is hard to understand.
Deep learning (DL) is one of the most powerful techniques in artificial intelligence (AI), and many researchers and scientists focus on deep learning architectures to improve the robustness and computational power of this tool. However, deep learning architectures also have some disadvantages and limitations when applied to classification tasks. One of the main problems of this model is that DL does not facilitate a comprehensive theoretical understanding of learning [202]. A well-known disadvantage of DL methods is their "black box" nature [203,204]. That is, the method by which DL methods come up with the convolved output is not readily understandable. Another limitation of DL is that it usually requires much more data than traditional machine learning algorithms, which means that this technique cannot be applied to classification tasks over small data sets [205,206]. Additionally, the massive amount of data needed for DL classification algorithms further exacerbates the computational complexity during the training step [207].

Semi-Supervised Learning for Text Classification
Many researchers have developed many efficient classifiers for both labeled and unlabeled documents. Semi-supervised learning is a type of supervised learning problem that uses unlabeled data to train a model. Usually, researchers and scientists prefer to use semi-supervised techniques when a small part of the data set contains labeled data points and a large amount of data set does not include labels [208]. Most of the semi-supervised learning algorithms for classification tasks use a clustering technique (generally used for unsupervised learning [209]) as follows: Initially a clustering technique is applied on D T with K = K (the number of classes), since D T has labeled samples of all K classes [208]. If a partition P i has labeled samples, then, all data points on that cluster belongs to that label.
The research goal for clustering techniques is to determine if we have more than one class labeled on one cluster, and what happens if we have no labeled data point in one cluster [210]. In this part, we briefly describe the most popular technique of semi-supervised text and document classification. O. Chapelle and A. Zien [211] worked on semi-supervised classification via low density separation, which combines graph distance computation with transductive support vector machine (TSVM) training. K. Nigam et al. [212] developed a technique for text classification using expectation maximization (EM) and generative models for semi-supervised learning with labeled and unlabeled data in the field of text classifications. L. Shi et al. [213] introduced a method for transferring classification knowledge across languages via translated features. This technique uses an EM algorithm that naturally takes into account the ambiguity associated with the translation of a word. J. Su et al. [213] introduced "Semi-supervised Frequency Estimate (SFE)", a MNBC method for large scale text classification. S. Zhou et al. [214] invented a novel deep learning method that uses fuzzy DBN for semi-supervised sentiment classification. This method employs a fuzzy membership function for each category of reviews based on the learned architecture.

Evaluation
In the research community, having shared and comparable performance measures to evaluate algorithms is preferable. However, in reality such measures may only exist for a handful of methods. The major problem when evaluating text classification methods is the absence of standard data collection protocols. Even if a common collection method existed (e.g., Reuters news corpus), simply choosing different training and test sets can introduce inconsistencies in model performance [215]. Another challenge with respect to method evaluation is being able to compare different performance measures used in separate experiments. Performance measures generally evaluate specific aspects of classification task performance, and thus do not always present identical information. In this section, we discuss evaluation metrics and performance measures and highlight ways in which the performance of classifiers can be compared. Since the underlying mechanics of different evaluation metrics may vary, understanding what exactly each of these metrics represents and what kind of information they are trying to convey is crucial for comparability. Some examples of these metrics include recall, precision, accuracy, F-measure, micro-average, and macro average. These metrics are based on a "confusion matrix" (shown in Figure 24) that comprises true positives (TP), false positives (FP), false negatives (FN), and true negatives (TN) [216]. The significance of these four elements may vary based on the classification application. The fraction of correct predictions over all predictions is called accuracy (Equation (166)). The fraction of known positives that are correctly predicted is called sensitivity i.e., true positive rate or recall (Equation (167)). The ratio of correctly predicted negatives is called specificity (Equation (168)). The proportion of correctly predicted positives to all positives is called precision, i.e., positive predictive value (Equation (169)).

Macro-Averaging and Micro-Averaging
A single aggregate measure is required when several two-class classifiers are being used to process a collection. Macro-averaging gives a simple average over classes while micro-averaging combines per-document decisions across classes and then outputs an effective measure on the pooled contingency table [217]. Macro-averaged results can be computed as follows: where B is a binary evaluation measure calculated based on true positives (TP), false positives (FP), false negatives (FN), and true negatives (TN), and L = {λ j : j = 1...q} is the set of all labels. Micro-averaged results [156,218] can be computed as follows: Micro-average score assigns equal weights to every document as a consequence, and it is considered to be a per-document average. On the other hand, macro-average score assigns equal weights to each category without accounting for frequency and therefore, it is a per-category average.

F β Score
F β is one of the most popular aggregated evaluation metrics for classifier evaluation [216]. The parameter β is used to balance recall and precision and is defined as follows: For commonly used β = 1 i.e., F 1 , recall and precision are given equal weights and Equation (174) can be simplified to: Since F β is based on recall and precision, it does not represent the confusion matrix fully.

Matthews Correlation Coefficient (MCC)
The Matthews correlation coefficient (MCC) [30] captures all the data in a confusion matrix and measures the quality of binary classification methods. MCC can be used for problems with uneven class sizes and is still considered a balanced measure. MCC ranges from −1 to 0 (i.e., the classification is always wrong and always true, respectively). MCC can be calculated as follows: While comparing two classifiers, one may have a higher score using MCC and the other one has a higher score using F 1 and as a result one specific metric cannot captures all the strengths and weaknesses of a classifier [216].

Receiver Operating Characteristics (ROC)
Receiver operating characteristics (ROC) [219] curves are valuable graphical tools for evaluating classifiers. However, class imbalances (i.e., differences in prior class probabilities [220]) can cause ROC curves to poorly represent the classifier performance. ROC curve plots true positive rate (TPR) and false positive rate (FPR):

Area Under ROC Curve (AUC)
The area under ROC curve (AUC) [31,32] measures the entire area underneath the ROC curve. AUC leverages helpful properties such as increased sensitivity in the analysis of variance (ANOVA) tests, independence from decision threshold, invariance to a priori class probabilities, and indication of how well negative and positive classes are in regarding the decision index [221].
For binary classification tasks, AUC can be formulated as: For multi-class AUC, an average AUC can be defined [222] as follows: where C is the number of the classes. Yang [215] evaluated statistical approaches for text categorization and reported the following important factors that should be considered when comparing classifier algorithms: • Comparative evaluation across methods and experiments which gives insight about factors underlying performance variations and will lead to better evaluation methodology in the future; • Impact of collection variability such as including unlabeled documents in training or test set and treat them as negative instances can be a serious problem; • Category ranking evaluation and binary classification evaluation show the usefulness of classifier in interactive applications and emphasize their use in a batch mode respectively. Having both types of performance measurements to rank classifiers is helpful in detecting the effects of thresholding strategies; • Evaluation of the scalability of classifiers in large category spaces is a rarely investigated area.

Discussion
In this article, we aimed to present a brief overview of text classification techniques, alongside a discussion of corresponding pre-processing steps and evaluation methods. In this section, we compare and contrast each of these techniques and algorithms. Moreover, we discuss the limitations of existing classification techniques and evaluation methods. The main challenge to choosing an efficient classification system is understanding similarity and differences of available techniques in different pipeline steps.

Text and Document Feature Extraction
We outlined the following two main feature extraction approaches: Weighted words (bag-of-words) and word embedding. Word embedding techniques learn from sequences of words by taking into consideration their occurrence and co-occurrence information. Also, these methods are unsupervised models for generating word vectors. In contrast, weighted words features are based on counting words in documents and can be used as a simple scoring scheme of word representation. Each technique presents unique limitations.
Weighted words computes document similarity directly from the word-count space which increases the computational time for large vocabularies [223]. While counts of unique words provide independent evidence of similarity, they do not account for semantic similarities between words (e.g., "Hello" and "Hi"). Word embedding methods address this issue but are limited by the necessitation of a huge corpus of text data sets for training [224]. As a result, scientists prefer to use pre-trained word embedding vectors [224]. However, this approach cannot work for words missing from these text data corpora.
For example, in some short message service (SMS) data sets, people use words with multiple meaning such as slang or abbreviation which do not have semantic similarities. Furthermore, abbreviations are not included in the pre-trained word embedding vectors. To solve these problems, many researchers work on text cleaning as we discussed in Section 2. The word embedding techniques such as GloVe, FastText, and Word2Vec were trained based on the word and nearest neighbor of that word, and this contains a very critical limitation (the meaning of a word could be different in two different sentences). To solve this problem, scientist have come up with the novel methods called contextualized word representations, which train based on the context of the word in a document.
As shown in Table 1, we compare and evaluate each technique including weighted words, TF-IDF, Word2Vec, Glove, FastText, and contextualized word representations.

Dimensionality Reduction
In Section 3, we outlined many dimensionality reduction techniques. In this section, we discuss how the efficacy of this step with respect to a text classification system's computational time and robustness. Dimensionality reduction is mostly used for improving computational time and reducing memory complexity.
PCA attempts to find orthogonal projections of the data set which contains the highest variance possible in order to extract linear correlations between variables of the data set. The main limitation of PCA is the computational complexity of this technique for dimensionality reduction [225]. To solve this problem, scientists introduced the random projection technique (Section 3).
LDA is a supervised technique for dimension reduction that can improve the predictive performance of the extracted features. However, LDA requires researchers to manually input the number of components, requires labeled data, and produces features that are not easily interpretable [226].
Random projection is much faster computationally than PCA. However, this method does not perform well for small data sets [227].
Autoencoders requires more data to train than other DR methods, and thus cannot be used as a general-purpose dimensionality reduction algorithm without sufficient data.
T-SNE is mostly used for data visualization in text and document data sets.

Existing Classification Techniques
In this section, we discuss the limitations and advantages of existing text and document classification algorithms. Then we compare state-of-the-art techniques in two tables.

Limitations and Advantages
As shown in Tables 2 and 3, the Rocchio algorithm is limited by the fact that the user can only retrieve a few relevant documents using this model [108]. Furthermore, the algorithms' results illustrate several limitations in text classification, which could be addressed by taking semantics into consideration [109]. Boosting and bagging methods also have many limitations and disadvantages, such as the computational complexity and loss of interpretability [117]. LR works well for predicting categorical outcomes. However, this prediction requires that each data point be independent [124] which is attempting to predict outcomes based on a set of independent variables [125]. Naïve Bayes algorithm also has several limitations. NBC makes a strong assumption about the shape of the data distribution [134,135]. NBC is also limited by data scarcity for which any possible value in feature space, a likelihood value must be estimated by a frequentist [136]. KNN is a classification method that is easy to implement and adapts to any kind of feature space. This model also naturally handles multi-class cases [140,141]. However, KNN is limited by data storage constraint for large search problems to find the nearest neighbors. Additionally, the performance of KNN is dependent on finding a meaningful distance function, thus making this technique a very data-dependent algorithm [142,143]. SVM has been one of the most efficient machine learning algorithms since its introduction in the 1990s [159]. However, they are limited by the lack of transparency in results caused by a high number of dimensions. Due to this, it cannot show the company score as a parametric function based on financial ratios nor any other functional form [159]. A further limitation is a variable financial ratios rate [160]. The decision tree is a very fast algorithm for both learning and prediction, but it is also extremely sensitive to small perturbations in the data [166], and can be easily overfit [167]. These effects can be negated by validation methods and pruning, but this is a grey area [166]. This model also has problems with out-of-sample prediction [168]. Random forests (i.e., ensembles of decision trees) are very fast to train in comparison to other techniques, but quite slow to create predictions once trained [172]. Thus, in order to achieve a faster structure, the number of trees in forest must be reduced, as more trees in forest increases time complexity in the prediction step. With regards to CRF, the most evident disadvantage of CRF is the high computational complexity of the training step [176], and this algorithm does not perform with unknown words (i.e., with words that were not present in training data sample) [177]. Deep learning (DL) is one of the most powerful techniques in artificial intelligence (AI), and many researchers and scientists focus on deep learning architectures to improve the robustness and computational power of this tool. However, deep learning architectures also have some disadvantages and limitations when applied to classification tasks. One of the main problems of this model is that DL does not facilitate comprehensive theoretical understanding of learning [202]. A well-known disadvantage of DL methods is their "black box" nature [203,204]. That is, the method by which DL methods come up with the convolved output is not readily understandable. Another limitation of DL is that it usually requires much more data than traditional machine learning algorithms, which means that this technique cannot be applied to classification tasks over small data sets [205,206]. Additionally, the massive amount of data needed for DL classification algorithms further exacerbates the computational complexity during the training step [207].   Tables 4 and 5, text classification techniques are compared with the criteria: Architecture, author(s), model, novelty, feature extraction, details, corpus, validation measure, and limitation of each technique. Each text classification technique (system) contains a model which is the classifier algorithm, and also needs a feature extraction technique which means converting texts or documents data set into numerical data (as discussed in Section 2). Another important part in our comparison is the validation measure which is used to evaluate the system.

Evaluation
The experimental evaluation of text classifiers measures effectiveness (i.e., capacity to make the right classification or categorization decision). Precision and recall are widely used to measure the effectiveness of text classifiers. Accuracy and error ( FP+FN TP+TN+FP+FN = 1 − accuracy), on the other hand, are not widely used for text classification applications because they are insensitive to variations in the number of correct decisions due to the large value of the denominator (TP + TN) [215]. The pitfalls of each of the above-mentioned metrics are listed in Table 6.

Text Classification Usage
In the earliest history of ML and AI, text classification techniques have mostly been used for information retrieval systems. However, as technological advances have emerged over time, text classification and document categorization have been globally used in many domains such as medicine, social sciences, healthcare, psychology, law, engineering, etc. In this section, we highlight several domains which make use of text classification techniques.

Information Retrieval
Information retrieval is finding documents of an unstructured data that meet an information need from within large collections of documents [230]. With the rapid growth of online information, particularly in text format, text classification has become a significant technique for managing this type of data [231]. Some of the important methods used in this area are Naïve Bayes, SVM, decision tree, J48, KNN, and IBK [232]. One of the most challenging applications for document and text data set processing is applying document categorization methods for information retrieval [34,233].

Information Filtering
Information filtering refers to the selection of relevant information or rejection of irrelevant information from a stream of incoming data. Information filtering systems are typically used to measure and forecast users' long-term interests [234]. Probabilistic models, such as the Bayesian inference network, are commonly used in information filtering systems. Bayesian inference networks employ recursive inference to propagate values through the inference network and return documents with the highest ranking [34]. Buckley, C. [235] used vector space model with iterative refinement for filtering task.

Sentiment Analysis
Sentiment analysis is a computational approach toward identifying opinion, sentiment, and subjectivity in text [236]. Sentiment classification methods classify a document associated with an opinion to be positive or negative. The assumption is that document d is expressing an opinion on a single entity e and opinions are formed via a single opinion holder h [237]. Naive Bayesian classification and SVM are some of the most popular supervised learning methods that have been used for sentiment classification [238]. Features such as terms and their respective frequency, part of speech, opinion words and phrases, negations, and syntactic dependency have been used in sentiment classification techniques.

Recommender Systems
Content-based recommender systems suggest items to users based on the description of an item and a profile of the user's interests [239].
A user's profile can be learned from user feedback (history of the search queries or self reports) on items as well as self-explained features (filter or conditions on the queries) in one's profile. In this way, input to such recommender systems can be semi-structured such that some attributes are extracted from free-text field while others are directly specified [240]. Many different types of text classification methods, such as decision trees, nearest neighbor methods, Rocchio's algorithm, linear classifiers, probabilistic methods, and Naive Bayes, have been used to model user's preference.

Knowledge Management
Textual databases are significant sources of information and knowledge. A large percentage of corporate information (nearly 80%) exists in textual data formats (unstructured). In knowledge distillation, patterns, or knowledge are inferred from immediate forms that can be semi-structured (e.g., conceptual graph representation) or structured/relational (e.g., data representation). A given intermediate form can be document-based such that each entity represents an object or concept of interest in a particular domain. Document categorization is one of the most common methods for mining document-based intermediate forms [241]. In other work, text classification has been used to find the relationship between railroad accidents' causes and their correspondent descriptions in reports [242].

Document Summarization
Text classification used for document summarizing in which the summary of a document may employ words or phrases which do not appear in the original document [243]. Multi-document summarization also is necessitated due to the rapid increase in online information [244]. Thus, many researchers focus on this task using text classification to extract important features out of a document.

Health
Most textual information in the medical domain is presented in an unstructured or narrative form with ambiguous terms and typographical errors. Such information needs to be available instantly throughout the patient-physicians encounters in different stages of diagnosis and treatment [245]. Medical coding, which consists of assigning medical diagnoses to specific class values obtained from a large set of categories, is an area of healthcare applications where text classification techniques can be highly valuable. In other research, J. Zhang et al. introduced Patient2Vec to learn an interpretable deep representation of longitudinal electronic health record (EHR) data which is personalized for each patient [246]. Patient2Vec is a novel technique of text data set feature embedding that can learn a personalized interpretable deep representation of EHR data based on recurrent neural networks and the attention mechanism. Text classification has also been applied in the development of Medical Subject Headings (MeSH) and Gene Ontology (GO) [247].

Social Sciences
Text classification and document categorization has increasingly been applied to understanding human behavior in past decades [38,248]. Recent data-driven efforts in human behavior research have focused on mining language contained in informal notes and text data sets, including short message service (SMS), clinical notes, social media, etc. [38]. These studies have mostly focused on using approaches based on frequencies of word occurrence (i.e., how often a word appears in a document) or features based on linguistic inquiry word count (LIWC) [249], a well-validated lexicon of categories of words with psychological relevance [250].

Business and Marketing
Profitable companies and organizations are progressively using social media for marketing purposes [251]. Opening mining from social media such as Facebook, Twitter, and so on is main target of companies to rapidly increase their profits [252]. Text and documents classification is a powerful tool for companies to find their customers more easily.

Law
Huge volumes of legal text information and documents have been generated by government institutions. Retrieving this information and automatically classifying it can not only help lawyers but also their clients [253]. In the United States, the law is derived from five sources: Constitutional law, statutory law, treaties, administrative regulations, and the common law [254]. Many new legal documents are created each year. Categorization of these documents is the main challenge for the lawyer community.

Conclusions
The classification task is one of the most indispensable problems in machine learning. As text and document data sets proliferate, the development and documentation of supervised machine learning algorithms becomes an imperative issue, especially for text classification. Having a better document categorization system for this information requires discerning these algorithms. However, the existing text classification algorithms work more efficiently if we have a better understanding of feature extraction methods and how to evaluate them correctly. Currently, text classification algorithms can be chiefly classified in the following manner: (I) Feature extraction methods, such as Term Frequency-Inverse document frequency (TF-IDF), term frequency (TF), word-embedding (e.g., Word2Vec, contextualized word representations, Global Vectors for Word Representation (GloVe), and FastText), are widely used in both academic and commercial applications. In this paper, we had addressed these techniques. However, text and document cleaning could help the accuracy and robustness of an application. We described the basic methods of text pre-processing step. (II) Dimensionality reduction methods, such as principal component analysis (PCA), linear discriminant analysis (LDA), non-negative matrix factorization (NMF), random projection, Autoencoder, and t-distributed Stochastic Neighbor Embedding (t-SNE), can be useful in reducing the time complexity and memory complexity of existing text classification algorithms. In a separate section, the most common methods of dimensionality reduction were presented. (III) Existing classification algorithms, such as the Rocchio algorithm, bagging and boosting, logistic regression (LR), Naïve Bayes Classifier (NBC), k-nearest Neighbor (KNN), Support Vector Machine (SVM), decision tree classifier (DTC), random forest, conditional random field (CRF), and deep learning, are the primary focus of this paper. (IV) Evaluation methods, such as accuracy, F β , Matthew correlation coefficient (MCC), receiver operating characteristics (ROC), and area under curve (AUC), are explained. With these metrics, the text classifcation algorithm can be evaluated. (V) Critical limitations of each component of the text classification pipeline (i.e., feature extraction, dimensionality reduction, existing classification algorithms, and evaluation) were addressed in order to each technique. And finally we compare the most common text classification algorithm in this section. (V) Finally, the usage of text classification as an application and/or support other majors such as lay, medicine, etc. are covered in a separate section.
In this survey, Recent techniques and trending of text classification algorithm have discussed.