## 4 Proposed Sentiment Analysis Methodology
### Feature Generation  
In this research, the tweets are manually annotated using a unigram model that offers a reasonable coverage degree for the dataset. In order to extract the most important features from the training dataset, data preprocessing and feature generation are executed to convert the tweets into a feature vector. An encoder is generated from the vectorization process of the training dataset to be applied to the testing dataset. The generated encoder converts the tweets into a set of feature vectors that are applied on the training and testing datasets. Text and tweets are applied as vectors using the TF-IDF technique that converts the given text into finite feature vectors. The term frequency (TF) computes the number of times the selected term is repeated in a given document. In contrast, the inverse document frequency (IDF) computes the number of times the selected term is repeated in the overall dataset or corpus.  
Figure 3: Data preprocessing levels on sentiment analysis documents.  
\begin{table}
\begin{tabular}{c c c c c} \hline \hline
**Dataset** & **Positive** & **Negative** & **Neutral** & **Total** \\ \hline Imbalanced & 2843 & 2751 & 11,129 & 16,723 \\ \% & 17\% & 16.5\% & 66.5\% & 100\% \\ Balanced with 2 Classes & 2725 & 2726 & - & 5451 \\ \% & 50\% & 50\% & - & 100\% \\ \hline \hline \end{tabular}
\end{table}
Table 3: Balanced dataset with binary classification.  
The TF-IDF method has a linear computational complexity regarding the number of text lines and words per line. In contrast, the RF feature selection algorithm has a computational complexity of \(O(n\)_estimators_\(\times\)\(m\)\(\times\)\(\log(n))\), where \(n\) is the number of samples, \(m\) is the number of features, and log is the base-2 logarithm. Finally, the NB classifier is a simple and computationally efficient algorithm with \(O(n\times d)\) computational complexity, where \(n\) is the number of samples and \(d\) is the number of features.  
The corpus data contains different sentiment analysis documents with different word and polarity terms. The documents are collected from Twitter to analyze users' orientation and attitudes based on their positive or negative polarity. As presented in Equations (2)-(4), the overall vectorization of the dataset is explained:  
\[TF\;(p_{t}\;,\;s_{d})=\frac{\sum_{t=1}^{n}p_{it}\;\in\;w_{t}}{\sum_{j=1}^{m}w_ {tj}\;\in\;s_{d}} \tag{2}\]  
\[DF\;(p_{t}\;,\;c_{d})=log\;\bigg{(}\frac{N}{Count\;(s_{d}\in\;c_{d}\;:\;p_{t} \in\;s_{d})}\bigg{)} \tag{3}\]  
\[TF-IDF\;(p_{t}\;,\;s_{d}\;,\;c_{d})=TF\;(p_{t}\;,\;s_{d})\times IDF\;(p_{t}\;, \;c_{d}) \tag{4}\]  
where:  
\(w_{t}\) : word terms.  
\(p_{t}\) : polarity terms.  
\(s_{d}\) : sentiment analysis documents.  
\(c_{d}\) : corpus data for all documents.  
The corpus data \(c_{d}\) contain different documents of sentiment analysis \(s_{d}\) from different domains and sources that reflect the users' opinions about different services. Each sentiment analysis document \(s_{d}\) contains a large number of sentences with word terms \(w_{t}\) that contain polarity terms \(p_{t}\) that explores users' orientations. As shown in Equation (4), \(TF-IDF\) is calculated by measuring the resulting score of the multiplication between \(TF\) and \(IDF\). The higher the resulting score, the more relevant the polarity term in the sentiment analysis documents \(s_{d}\).