Optimization SAML
Optimization SAML
(2017) 7:32
DOI 10.1186/s13673-017-0116-3
*Correspondence:
profjaspreetbatth@gmail. Abstract
com Words and phrases bespeak the perspectives of people about products, services,
Department of Computer
Science, Guru Nanak Dev governments and events on social media. Extricating positive or negative polarities
University, Amritsar, India from social media text denominates task of sentiment analysis in the field of natural
language processing. The exponential growth of demands for business organiza-
tions and governments, impel researchers to accomplish their research in sentiment
analysis. This paper leverages four state-of-the-art machine learning classifiers viz. Naïve
Bayes, J48, BFTree and OneR for optimization of sentiment analysis. The experiments
are performed using three manually compiled datasets; two of them are captured
from Amazon and one dataset is assembled from IMDB movie reviews. The efficacies
of these four classification techniques are examined and compared. The Naïve Bayes
found to be quite fast in learning whereas OneR seems more promising in generating
the accuracy of 91.3% in precision, 97% in F-measure and 92.34% in correctly classified
instances.
Keywords: Sentiment analysis, Social media text, Movie reviews, Product reviews,
Machine learning classifiers
© The Author(s) 2017. This article is distributed under the terms of the Creative Commons Attribution 4.0 International License
(http://creativecommons.org/licenses/by/4.0/), which permits unrestricted use, distribution, and reproduction in any medium,
provided you give appropriate credit to the original author(s) and the source, provide a link to the Creative Commons license, and
indicate if changes were made.
Singh et al. Hum. Cent. Comput. Inf. Sci. (2017) 7:32 Page 2 of 12
Levels of sentiment
Due to scarcity of opinion text available in digital form, very less research interest on
computational linguistics in the last decade of twentieth century was witnessed [2–4].
The escalation of social media text on internet attracts young researchers to define the
level of granularities of text. The web text is classified into three levels viz. document
level, sentence level and word level. In [5], the fourth level granularity is defined by using
deep convolution neural network. This fourth level is character level feature extrac-
tion approach used for extracting features of each character window from given word
(Table 1).
1. Document [15] ‘\n’ Newline char- Overall opinion at Single opinion of Overall sentiment of
acter upper level multiple entities one document
2. Sentence [16] ‘.’ Period character Factual polarity of Multiple opinions of Subjectivity clas-
individual sen- multiple entities sification
tences
3. Entity or aspect Space character or At finest level words Single opinion of Two-tuple as <Senti-
level [12] named entities are the target single entity ment, target>
entities
4. Character level [5] Special symbols and Micro level of char- Multiple opinions Morphological
space characters acter embedding about single word extraction of words
are omitted entity
Singh et al. Hum. Cent. Comput. Inf. Sci. (2017) 7:32 Page 3 of 12
n
P(xi /y)
P(y/x1 , x2 , . . . . . . xn ) = P y × (1)
P(x1 , x2 , . . . . . . xn )
i=1
where (Term) can be unigram, bigram and trigram. In this study we have considered
unigrams and bigrams. The example in the Table 2 contains bigrams like “Horrible act-
ing”, “Bad writing” and “Very misleading” are labeled with negative sentiment whereas
the term “More enjoyable” reflects positive sentiment towards the movie. The decision
tree of J48 algorithm for obtaining sentiment form text is represented in the Fig. 1 below.
Table 2 Initial four reviews of training set and two reviews test set
Set Sentence Review Class
text taken from movie reviews and classify them at document level by tagging appro-
priate labels. BFTree extracts best node from labeled and trained binary tree nodes to
reduce the error computed from information gain.
|Si |
Infogain (S, A) = Entropy(S) − × Entropy(Si ) (3)
S
i∈V (A)
where S is word feature term of test set and A is the attribute of sampled term from
training set. V(A) denotes set of all possible values of A. The binary tree stops growing
when an attribute A captures single value or when value of information gain vanishes.
most frequent terms of a particular sentence is made on the basis of class of featured
terms from training set. The demonstration of OneR algorithm for sentiment prediction
with smallest error of classification is given below:
m
DF = N1i (4)
i=1
The MI method measures features of text by computing similarity of word terms ‘w’
and category ‘c’.
P(w/c)
SimInfo (w, c) = log (5)
P(w)
N1 × N
MI = log (6)
(N1 + N3 )(N1 + N2 )
The normalization module converts all letters into lowercase, removal of punctuation
marks and special symbols, conversion of numbers into words, expansion of abbrevi-
ation and limiting the average length of twenty words in a sentence. Each sentence is
delimited by a newline character. The Python’s NLTK and bs4 libraries are used for this
purpose. Data splitter take the ratio of (80:20) of (Train: Test) subsets. We have used
manual splitting of dataset at the time of retrieval of data from web. The four classifi-
ers are trained with training subsets followed by performance evaluation. The evaluation
metrics taken in the experiment are precision, recall, accuracy and F-measure.
Singh et al. Hum. Cent. Comput. Inf. Sci. (2017) 7:32 Page 7 of 12
Related work
Existing approaches of sentiment prediction and optimization widely includes SVM and
Naïve Bayes classifiers. Hierarchical machine learning approaches yields moderate per-
formance in classification tasks whereas SVM and Multinomial Naïve Bayes are proved
better in terms of accuracy and optimization. Sentiment analysis using neural network
architectures has appeared in very few works. The sentiment prediction methods using
recursive neural networks and deep convolution neural networks are bit complex in cap-
turing compositionality of words. Extracting character level features and embeddings
of complex words is found hard in many neural network architectures whereas extract-
ing sentence level or word level features such as morphological tags and stems are more
effectively achieved in convolutional neural networks. A very few researchers have used
J48, BFTree and OneR for the task of sentiment prediction. These three classifiers are
utilized for other classification tasks like emotion recognition from text and twitter’s text
categorizations. The summary of benchmarks related to machine learning techniques in
terms of accuracy of classification is listed in the Table 2. SVM and Naive Bayes are prov-
ing better in terms of benchmarks than other machine learning techniques (Table 3).
Datasets taken
Three Datasets are manually annotated from http://www.amazon.in. First dataset con-
sists of product reviews of Woodland’s wallet are taken from 12th October 2016 to 25th
October 2016 for training set containing 88 reviews and from 25th October 2016 to 30th
October 2016 for testing set containing 12 randomly chosen product reviews with their
sentiments prediction using four machine learning algorithms. Second dataset consists
of 7465 Digital Camera reviews of Sony are taken from 01st October 2016 to 25th Octo-
ber 2016 for training set and 1000 reviews are from 25th October 2016 to 30th October
2016 for test dataset. Third dataset consists of movie reviews taken from http://www.
imdb.com. It contains 2421 reviews for training set and 500 reviews for test set.
Kiritchenko and Mohammad (2016) SVM with RBF kernel, POS, sentiment score, emoti- Supervised sentiment analysis system using 82.60 for bigrams 80.90 for trigrams
cons, embedding vectors [17] real-valued sentiment score to analyze social
networking data
Dashtipour et al. (2016) SVM, MNB, maximum entropy [18] Multilingual sentiment analysis for improving the 86.35
Singh et al. Hum. Cent. Comput. Inf. Sci. (2017) 7:32
Kiritchenko et al. (SemEval-2016) task 7 Supervised learning, random forest, PMI, Gaussian Automatic sentiment score determination model Kendall’s rank coeff. (K) K = 0.704 for Gen. English
regression, NRC emoticons, SentiWordNet [6] for general English, English Twitter corpus and 0.523 for English Twitter, and 0.536 for Arabic
Arabic Twitter corpus Twitter
Pang et al. (2002) Naïve Bayes, SVM, maximum entropy classifiers Performed feature based analysis on movie 78.7 for NB, 77.7 for ME and 82.9 for SVM
with unigrams, bigrams, POS, adjectives and reviews using three machine learning classifiers
word frequency features [3] for sentiment classification
Nogueira dos Santos and Gatti (2014) Convolution neural network using word-level and Proposed convolution neural network for classifi- 85.7 for binary classification, 48.3 for fine grained
character-level embedding vectors [5] cation of short text messages from Twitter using classification and 86.4 for STS corpus
character level word embeddings
Poria et al. (2015) Ensemble classifier using POS, Sentic, negation, The proposed algorithm captures contextual 88.12 for movie review dataset, 88.27 for Blitzer
modification and common sense knowledge polarity and flow of concepts from text for derived dataset and 82.75 for Amazon corpus
features [4] dynamic sentiment analysis
Poria et al. (2016) SVM and Naïve Bayes, CNN used for extracting Convolutional multiple kernel learning for enhanc- 96.12 for proposed model without feature selection
video, audio and textual features (word embed- ing the performance of sentiment analysis and and 96.55 with feature selection
dings and POS) [24] emotion recognition
Wang et al. (2016) Back propagation and stochastic gradient descent Proposed regional convolutional neural network Pearson correlation coefficient r = 0.778 between
used to learn model parameters along with and long short term memory model for fine CNN-LSTM and LSTM, for English text and
features such as n-gram and word vector for grained sentiment analysis r = 0.781 for Chinese text
Valence–Arousal prediction [25]
Page 9 of 12
Singh et al. Hum. Cent. Comput. Inf. Sci. (2017) 7:32 Page 10 of 12
below. All four classifiers improved in accuracies with the increase of features from 15 to
42. This shows the direct proportionality of multiple features with learning capability for
machine learning algorithms.
Conclusion
This paper exploits four machine learning classifiers for sentiment analysis using three
manually annotated datasets. The mean of 29 epochs of experimentation recorded in
Table 4 shows that OneR is more precise in terms of percentage of correctly classified
instances. On the other hand, Naïve Bayes exhibits faster learning rate and J48 reveals
adequacy in the true positive and false positive rates. Table 5 reveals the truth that J48
and OneR are better for smaller dataset of woodland’s wallet reviews. The preprocessing
of proposed methodology is limited to extract foreign words, emoticons and elongated
words with their appropriate sentiments. The future work in the task of sentiment analy-
sis has scope to improve preprocessing with word embeddings using deep neural net-
works and can also extend this study through convolution neural networks.
Authors’ contributions
JS made substantial contributions to conception and design, or acquisition of data, or analysis and interpretation of data.
GS helped in revision and has given final approval of the version to be published. RS agreed to be accountable for all
aspects of the work in ensuring that questions related to the accuracy or integrity of any part of the work are appropri-
ately investigated and resolved. All authors read and approved the final manuscript.
Acknowledgements
This research was supported by Department of Computer Science, Guru Nanak Dev University, Amritsar. I thank Dr.
Gurvinder Singh and Dr. Rajinder Singh for their participation in experimental work and their assistance to improve the
manuscript.
Competing interests
This research work has non-financial Academic and intellectual competing interests.
Funding information
No funding was received from any funder.
Publisher’s Note
Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.
References
1. Parvathy G, Bindhu JS (2016) A probabilistic generative model for mining cybercriminal network from online social
media: a review. Int J Comput Appl 134(14):1–4. doi:10.5120/ijca2016908121
2. Cambria E, White B (2014) Jumping NLP curves: a review of natural language processing research. IEEE Comput
Intell Mag 9(2):48–57. doi:10.1109/mci.2014.2307227
3. Pang B, Lee L, Vaithyanathan S (2002) Thumbs up? In: Proceedings of the ACL-02 conference on empirical methods
in natural language processing—EMNLP ‘02. doi:10.3115/1118693.1118704
4. Poria S, Cambria E, Gelbukh A, Bisio F, Hussain A (2015) Sentiment data flow analysis by means of dynamic linguistic
patterns. IEEE Comput Intell Mag 10(4):26–36. doi:10.1109/mci.2015.2471215
5. Nogueira dos Santos C, Gatti M (2014) Deep convolution neural networks for sentiment analysis of short texts. In:
Proceedings of COLING 2014, the 25th international conference on computational linguistics. p 69–78
6. Kiritchenko S, Mohammad S, Salameh M (2016) SemEval-2016 task 7: determining sentiment intensity of English
and Arabic phrases. In: Proceedings of the 10th international workshop on semantic evaluation (SemEval-2016).
doi:10.18653/v1/s16-1004
7. Cernian A, Sgarciu V, Martin B (2015) Sentiment analysis from product reviews using SentiWordNet as lexi-
cal resource. In: 2015 7th international conference on electronics, computers and artificial intelligence (ECAI).
doi:10.1109/ecai.2015.7301224
8. Hammer HL, Solberg PE, Øvrelid L (2014) Sentiment classification of online political discussions: a comparison of a
word-based and dependency-based method. In: Proceedings of the 5th workshop on computational approaches
to subjectivity, sentiment and social media analysis. doi:10.3115/v1/w14-2616
9. Zadeh L (2006) Toward human-level machine intelligence. In: 2006 18th IEEE international conference on tools with
artificial intelligence (ICTAI’06). doi:10.1109/ictai.2006.114
10. Joachims T (2002) Text classification. Learning to classify text using support vector machines. p 7-33.
doi:10.1007/978-1-4615-0907-3_2
11. Wanton TM, Porrata AP, Guijarro AM, Balahur A (2010) Opinion polarity detection—using word sense disambigua-
tion to determine the polarity of opinions. In: Proceedings of the 2nd international conference on agents and
artificial intelligence. doi:10.5220/0002703504830486
12. Xia Y, Cambria E, Hussain A, Zhao H (2014) Word polarity disambiguation using bayesian model and opinion-level
features. Cogn Comput 7(3):369–380. doi:10.1007/s12559-014-9298-4
13. Dey L, Chakraborty S, Biswas A, Bose B, Tiwari S (2016) Sentiment analysis of review datasets using Naïve Bayes’ and
K-NN classifier. Int J Inform Eng Electron Bus 8(4):54–62. doi:10.5815/ijieeb.2016.04.07
14. Nie CY, Wang J, He F, Sato R (2015) Application of J48 decision tree classifier in emotion recognition based on chaos
characteristics. In: Proceedings of the 2015 international conference on automation, mechanical control and com-
putational engineering. doi:10.2991/amcce-15.2015.330
15. Tan S, Zhang J (2008) An empirical study of sentiment analysis for Chinese documents. Expert Syst Appl 34(4):2622–
2629. doi:10.1016/j.eswa.2007.05.028
Singh et al. Hum. Cent. Comput. Inf. Sci. (2017) 7:32 Page 12 of 12
16. Mohammad SM, Zhu X, Kiritchenko S, Martin J (2015) Sentiment, emotion, purpose, and style in electoral tweets. Inf
Process Manage 51(4):480–499. doi:10.1016/j.ipm.2014.09.003
17. Kiritchenko S, Mohammad SM (2016) sentiment composition of words with opposing polarities. In: Proceedings
of the 2016 conference of the north american chapter of the association for computational linguistics: human
language technologies. doi:10.18653/v1/n16-1128
18. Dashtipour K, Poria S, Hussain A, Cambria E, Hawalah AY, Gelbukh A, Zhou Q (2016) Multilingual sentiment
analysis: state of the art and independent comparison of techniques. Cogn Comput 8(4):757–771. doi:10.1007/
s12559-016-9415-7
19. Sobhani P, Mohammad S, Kiritchenko S (2016) Detecting stance in tweets and analyzing its interaction with
sentiment. In: Proceedings of the 5th joint conference on lexical and computational semantics. doi:10.18653/v1/
s16-2021
20. Poria S, Cambria E, Winterstein G, Huang G (2014) Sentic patterns: dependency-based rules for concept-level senti-
ment analysis. Knowl Based Syst 69:45–63. doi:10.1016/j.knosys.2014.05.005
21. Socher R (2016) deep learning for sentiment analysis—invited talk. In: Proceedings of the 7th workshop on compu-
tational approaches to subjectivity, sentiment and social media analysis. doi:10.18653/v1/w16-0408
22. Turney PD, Mohammad SM (2014) Experiments with three approaches to recognizing lexical entailment. Nat Lang
Eng 21(03):437–476. doi:10.1017/s1351324913000387
23. Mohammad S, Kiritchenko S, Sobhani P, Zhu X, Cherry C (2016) SemEval-2016 task 6: detecting stance in tweets. In:
Proceedings of the 10th international workshop on semantic evaluation (SemEval-2016). doi:10.18653/v1/s16-1003
24. Poria S, Chaturvedi I, Cambria E, Hussain A (2016) Convolutional MKL based multimodal emotion recognition and
sentiment analysis. In: 2016 IEEE 16th international conference on data mining (ICDM). doi:10.1109/icdm.2016.0055
25. Wang J, Yu L, Lai KR, Zhang X (2016) Dimensional sentiment analysis using a regional CNN-LSTM model. In: Proceed-
ings of the 54th annual meeting of the association for computational linguistics, vol 2: short papers. doi:10.18653/
v1/p16-2037