Twitter’s Sentiment Analysis on Gsm Services using Multinomial Naïve Bayes

Telecommunication users are rapidly growing each year. As people keep demanding a better service level of Short Message Service (SMS), telephone or data use, service providers compete to attract their customer, while customer feedbacks in some platforms, for example Twitter, are their souce of information. Multinomial Naïve Bayes Tree, adapted from the method of Multinomial Naïve Bayes and Decision Tree, is one technique in data mining used to classify the raw data or feedback from customers.Multinomial Naïve Bayes method used specifically addressing frequency in the text of the sentence or document. Documents used in this study are comments of Twitter users on the GSM telecommunications provider in Indonesia.This research employed Multinomial Naïve Bayes Tree classification technique to categorize customers sentiment opinion towards telecommunication providers in Indonesia. Sentiment analysis only included the class of positive, negative and neutral. This research generated a Decision Tree roots in the feature "aktif" in which the probability of the feature "aktif" was from positive class in Multinomial Naive Bayes method. The evaluation showed that the highest accuracy of classification using Multinomial Naïve Bayes Tree (MNBTree) method was 16.26% using 145 features. Moreover, the Multinomial Naïve Bayes (MNB) yielded the highest accuracy of 73,15% by using all dataset of 1665 features. The expected benefits in this research are that the Indonesian telecommunications provider can evaluate the performance and services to reach customer satisfaction of various needs.


Introduction
Sentiment analysis is a technique to evaluate and identify either positive or negative emotions or opinions [1]. Sentiment analysis has been widely explored on documents with Twitter being one popular social media where users can express their opinion objectively about a broad range of topics [2], while 19% of them expressed their comment to brand and products [3], as well their emotion to cellular operator with an accuracy of 80% in predicting the sentiment 80% [4]. Cellular operator companies (provider) are those provide the service of telecommunication, particularly in GSM (Global System for Mobile communications) service are: Telkomsel (PT. Telekomunikasi Seluler), Indosat Ooredoo (PT. Satelit Indonesia / Satelindo), XL Axiata (PT XL Axiata Tbk) and Hutchison (PT. Hutchison CP Telecommunications Indonesia/ HCPT), with their different products such as Simpati and Halo (Telkomsel), IM3 and Mentari (Indosat Ooredoo), XL (XL Axiata) and Tri (Hutchison). Telecommunication users are growing each year as the demand of better service level of Short Message Service (SMS), telephone or data use, is also emerging. Consequently, service providers are competing to attract or maintain their customers, while the customers can express their feedback through platform like Twitter.
Naïve Bayes is a method to classify data, is an algorithm of inductive study for the most effective and efficient machine learning and data mining [5]. In the practice, it assumed that features are independent, while in fact each feature may have relation or dependency [6,7]. Thus, a method of NaiveBayes Tree was proposed as the integration of Naïve Bayes method and Decision Tree method. The basic concept of the decision tree is to convert the data into a tree and decision rules [8]. Naïve Bayes Tree is effectively capable of reducing computation 1355 time by diminishing redundancy in the data, resulting better accuracy compared to Naïve Bayes or Decision Tree method solely [9]. Adapting from the workflow for text classification in Naïve Bayes Tree method, Multinomial Naïve Bayes Tree (MNBTree) was resolved showing a better accuracy compared to Naïve Bayes Tree [10]. Raw data processing from Twitter requires a data preprocessing phase to generate the "standard words" as the feature to result the sentiment analysis [11]. The research on sentiment analysis has been widely conducted, for example in the field of politics [12], economy [13] and product quality survey [14]. Every consumers sentiment in Twitter about a product reflects the quality of the product, as well the sentiment towards service providers about the telecommunication service. This research about Twitter sentiment analysis employed the algorithm of NaiveBayesto detect the polarity of English tweet to reveal the best performance using biner classifier between two categories of contrast polarity: positiveand negative [15]. Other work with Naïve Bayes method to analyze the sentiment in Twitter about cellular operator in Indonesia had an accuracy of 72,22 % [4], Analysis of the mobile phone service provider quality in social media Twitter using Naïve Bayes shows the provider with the highest customer satisfaction level [16]. Yu and Hatzivassiloglou 2003 reported an accuracy of 97% in document classification of data acquisition of 400 sentences [17] dan memiliki and reported a good result for sentiment data classification using N-gram dan POS-tag as the features [18]. Thus, Naïve Bayes is an accurate, efficient and easily interpreted method of classification [19,20].
A variant of Naïve Bayes method to administer Multinomial data in text classification is Naïve BayesMultinomial method. Multinomial model yields better accuracy compared to Multivariate Bernoulli method in text classification with high number of vocabulary [21]. Multinomial Naïve Bayes method is a Naïve Bayes to estimate the frequency of term in a document. Substantially, MNBTree method stamdard can be improved by applying the transformation of TF-IDF (Term Frequency-Inverse Document Frequency)for feature and vector normalization with the rate of vector lentght observed in the data [22].

Research Method
This research was conducted with the step of data preparation, Twitter data preprocessing and sentiment classification modeling as shown in Figure 1. Data preparation was done by connecting with API (Application Programming Interface). The preprocessing comprised the conversion of tweet to lowercase words and removing the tweet from: ReTweet, user ID, punctuation, number, website link, stopwords, stemming, normalization and labeling. After data preprocessing, the data was transformed into matrix document which was the terms representation and frequency in a document. The final step consisted of the model construction of Multinomial Naïve Bayes using Weka 3.6, Multinomial Naïve Bayes Tree modeling using Netbeans IDE 8.0.2, and the evaluation of model.

Data Preparation
Twitter provides Application Programming Interface (API) to enable tweets acquisition by third party, which is free feature for a sample of 1% of all tweets [23]. The data used in this research was the tweet of comment in Bahasa, acquired from API on Twitter user status in Indonesian about telecommunication provider in Indonesia.

Preprocessing
After storing the tweets in data storage, the preprocessing was conducted in the following steps: 1. Converting tweet to lowercase and removing the following from the tweet: ReTweet, user ID, punctuation, number, website link, stopwords, stemming, normalization and labeling. Stemming has been commonly used by some researchers in natural language processing area such as text mining, text classification, and information retrieval [24]. Stemmingis transforming the word into its root word, while normalization is transforming words into the desired words, in this case was the casual words and local language into Bahasa. The result then was stored into a file. This stage resulted keywords of positive and negative sentiments (Table 1) which later were stored in a corpus and used for labelling for each tweet. 2. Labeling using lexicon dictionary and corpus as described in Table 1. Lexicon dictionary used was in English [25] which includes positive and negative sentiments and then translated into Bahasa using Google Translate. 3. Conducting tokenization, which is breaking down a sentence into root words and transforming into matrix using R programming.

Figure 1. Research Framework
Preprocessing was conducted using R programming. Labeling was conducted by subtracting total score of positive words with total score of negative words. Next, the data is classified into training and testing. Training data was used to provide information about the rule or pattern of a class. The MNBTree method was performed using Netbeans IDE 8.0.2 for training data and testing data.

Multinomial Naive Bayes method
Multinomial Naïve Bayes is a Naïve Bayes algorithm which administers Multinomial data in text classification. Data in Multinomial Naïve Bayes is represented as the total of data vector, thus Multinomial Naïve Bayes is appropriate for estimating term frequency in a document. In Multinomial Naïve Bayes, firstly the probability of words in a class (prior) was computed as Equation 1 [26]: where is the conditional probability of term occurring in a document d of a class . is the prior probability of a document occurring in class c. The probability of document d inc was perfomed using Equation 2 [26]:  (2) is the number of documents in class and is the total number of documents. The conditional probability as the relative frequency of term in documents belonging to class , as in Equation 3 [26]: is the number of occurences of term in training documents from class . is the number of all terms in the whole document in class including redundant term in the same document. The sparseness of term in the document resulted the estimationof frequency w as zero (0),thus we added one or laplace smoothing [26] as Equation 4: Where = | | is the number of terms in the vocabulary in training data. The algorithm of Multinomial Naïve Bayes for training step is as follows [26]: Training process in Multinomial Naïve Bayes algorithm is the step of the training the stage of data whereas the training sessions to the data describing that is the number of terms in the vocabulary in the training data then N is the number of times of data that sentences Twitter comments. For each class of data is calculated on the amount of data in each class( ) divided by the large number of data ( ) as listed in the Equation 2 and then for each text feature (t) in calculated the odds on each class using the Equation 3. If the conditions are not zero value then do laplace smoothing salty Equation 4. the next step is to apply the testing stages as follows [26]: At the stage of testing applied to the testing data for each class by calculating a score using Equation 2, then for each text features were calculated using Equation 3. If there are features worth zero then applied to the Equation 4. Application testing phase resulted in the probability of each class so the highest probability value is the winner of the class that is the biggest opportunity in each document.

Multinomial Naïve Bayes Tree Method (MNB Tree)
Multinomial Naïve Bayes Tree method develops the text classification in naïve BayesMultinomial for every node on Decision Tree. Multinomial Naïve Bayes Tree method was inspired by Naïve Bayes Tree method which has a high complexity of time in the steps. In the practice, Multinomial Naïve Bayes Tree algorithm is an adaptation from Decision Tree method and Multinomial Naïve Bayes method. Decision Tree is a method for data classification generating a tree-like structure, consisting the root (root node) and leaf (leaf node). Decision Tree method is able to administer categoric and numeric data. In the technique, Multinomial Naïve Bayes Tree developed a binary tree, where the attribute score was determined as zero and nonzero, with a measure of information gain in developing the tree to be efficient in time.
Algorithm: MNBTree Method(D) [10] Input: a training instances set D Output: The learnedMNBTree text classification 1. Set the minimum size setlto | D | * 40% 2. If | D | is less thanlthen create a leaf node and build a MNB using the instances falling into this leaf node, and then return 3. To each attribute W i , use Equation 5 to get its information gain [9]: (5) Where D set of documents or data, is feature is that the form of each word in the document, is the number of instances whose in the partitionvwhose while is documents number in the set of documents. 4. Let W max be the attribute with maximum information gainG max 5. If G max =0 then create a leaf node and build a MNB using the instances falling into this leaf node, and then return 6. Else for instance d in Where is the set of documents while P (c) is the probability of class c inD.
If the value of the resulting information gain is zero, or the number of features less than 40% of the amount of data (documents), the counting is done by using Mutinomial Naïve Bayes. The minimum value of the leaf (leaf) that l have empirical value | D | * 40% as the minimum size of leaves in an effort to reduce the consumption of time, overfitting, and reduce the complexity of leaf nodes on the training data [10]. Minimal size of the leaves affects the size of the tree is built.
Having in mind the minimum size of the leaves are then calculated for each attribute information gain W i . Where W i is the attribute that is said to feature i calculated using Equation 5. Next set W max be an attribute with the highest information value gain (G max ). If G max is zero used the left side branch (child left) is Dl were calculated using the MNB but if G max worth nonzero used right side branches (child right) are Dr. were calculated using the method Decision Tree.

Evaluation
This research employed Confusion Matrix to estimate the model accuracy. The measure and formula used in Confusion Matrix is as shown in Table 2 [27]. TP (True Positive) is the label for the data similar to model prediction result, while TN (True Negative) is label for data different from prediction result.FP is False Positive, while FN is False Negative.

Results and Analysis 3.1 Data Preparation
In the first step, connection to API (Application Programming Interface) was conducted by firstly registering to sign up an account for acquiring data from Twitter, particularly for obtaining API Key, API Secret, Access Token, Access Token Secret. After acquiring API Key, API Secret, Access Token, Access Token Secret, the next step is conducting authentification and registration. This resulted the data in form of Twitter users' comment. Then, the data was retrieved based on the desired keywords. Those data were stored in a frame in R programming and then saved in the file with CSV format (Comma Delimited Fitur). The data included were: text, favorited, favoriteCount, replyToSN, created, truncated, replyToSID, id, replyToUID, statusSource, screenname, retweetCount, isRetweet, retweeted, longitude and latitude. The feature used in this research was limited to the text column which was the content of the user's comment.
The input in this work was tweet (comment) of Twitter user in Bahasa acquired from API on the status of Twitter user using Bahasa about telecommunication provider in Indonesia. The official account of the providers are @Telkomsel, @kartuas, @simpati (Telkomsel); @Indosat, @Indosatcare, @Indosatmania (Indosat); and @XL, @XLandme, @XLcare (XL). Data preparation yielded 5210 commentsconsisted of the ads from provider and comments from Twitter user. The data mining was conducted from January 3, 2016 to January 5, 2016.

Multinomial Naïve Bayes Tree method
After the data was input to Multinomial Naïve Bayes Tree method, it generated root with highest information gain of the word "aktif" word left child "untung" and right child "negatif" class, while generating 22 Leaf.
The first step is to exercise the data to the Decision Tree method.The number of zero and nonzero value in each feature of the document was accumulated. Next, the probability of the positive, negative and neutral class with zero value as well as the entropy of each terms in the document was estimated.Then, the information gain of each feature (W i ) in the document was figured using Equation 5, where we obtained the highest value of information gain was 0.035136 of the feature "aktif" (W max ). The feature with highest information gain was assigned as the root of Decision Tree (G max ).
The feature "aktif" was assigned as the root of Decision Tree. After that, iterations were simulated to generate the leaves of feature with zero value (581 features) which then assigned as child left Dl, using Multinomial Naïve Bayesresulted negative class had the highest probability of 2.718463. Meanwhile, the feature with nonzero value was assigned as child right Dr (as much as 4601 documents), estimating the measure of highest information gain yielded the feature "untung" with the value of 0.025782.

Evaluation
The accuracy of the Twitter sentiment classification model using MNBTree method is shown as in Table 3. Based on Table 3, MNBTree model was evaluated with 5 runs of crossvalidation consisting 80% of training data and 20% testing data resulting highest accuracy of 21.652% in 145 features. Meanwhile, for Multinomial Naïve Bayes model had a highest accuracy of 73.15% in 1665 features. Table 4 shows the accuracy comparison between Multinomial Naive Bayes and MNBTree. The amount of feature was simulated from 145 to 1665 to reveal the best highest accuracy, whereas the determination was not based on any method. Based on Table 4, it was concluded that MNB method accuracy were increasing as the increase of the number of features, while MNBTree accuracy tended to increase when the feature was decreasing.

Conclusion
Based on Twitter sentiment analysis result on the telecommunication provider service performance using Multinomial Naïve Bayes Tree, the root with highest information gain was of the feature "aktif", in which the probability of the feature "aktif" was from positive class in Multinomial Naive Bayes method. The evaluation showed that the highest accuracy of classification using Multinomial Naïve Bayes Tree (MNBTree) method was 16.26% using 145 features. Moreover, the Multinomial Naïve Bayes (MNB) yielded the highest accuracy of 73,15% by using all dataset of 1665 features. The result of this research of sentiment analysis in Twitter comment using MNBTree method is a decision tere classification model of Twitter users comment as data to telecommunication service provider in Indonesia.For further research, a relevant topic will be the essential of using Lexicondictionary in proper and formal Bahasa as well as the addition of normalization dictionary of casual terms and local language, while the research itself can cover more than one class category in labeling.