Journal of Computer Sciences and Applications
ISSN (Print): 2328-7268 ISSN (Online): 2328-725X Website: Editor-in-chief: Minhua Ma, Patricia Goncalves
Open Access
Journal Browser
Journal of Computer Sciences and Applications. 2017, 5(2), 64-75
DOI: 10.12691/jcsa-5-2-3
Open AccessArticle

Stock Price Prediction Using Neural Network Models Based on Tweets Sentiment Scores

Anderson Rioba Ondieki1, , George Onyango Okeyo1 and Ann Kibe1

1School of Computing and Information Technology, Jomo Kenyatta University of Agriculture and Technology, Nairobi, Kenya

Pub. Date: July 10, 2017

Cite this paper:
Anderson Rioba Ondieki, George Onyango Okeyo and Ann Kibe. Stock Price Prediction Using Neural Network Models Based on Tweets Sentiment Scores. Journal of Computer Sciences and Applications. 2017; 5(2):64-75. doi: 10.12691/jcsa-5-2-3


Stock Exchange Prediction using neural networks has been an interesting research problem whereby many researchers have developed a keen interest in prediction of future values and trends. Little research has been done to apply and improve prediction models based on newer and impactful variables to show that mining opinions and sentiments from the information shared in Twitter platform can be converted into statistical values and applied as inputs in a neural network together with other inputs to facilitate an improvement in the accuracy of predictions of stock prices and movements. In this research, two stocks were selected on the basis of their social media communication in twitter and this information was used as additional feature by deploying a supervised learning approach to compute daily company twitter sentiment score for improving prediction purposes in neural networks. The daily twitter sentiment scores were computed in a supervised learning algorithm by use of WordNet and Sentiwordnet lexicons for classification and scoring. Through experimentation with different sets of hidden layers and 70% training set. 15% validation set and 15 % test set, the research applied two Non Linear Autoregressive Neural Network with Exogenous Inputs (NARX) models which were trained using Levenberg-Marquadt back propagation. The results showed that adding lexicon based twitter sentiment scores as additional inputs to other company stock variables for stock price prediction improved the prediction accuracy and resulted to a more accurate NARX model.

artificial neural networks accuracy sentiment scores Sentiwordnet Wordnet

Creative CommonsThis work is licensed under a Creative Commons Attribution 4.0 International License. To view a copy of this license, visit


Figure of 10


[1]  Anshul M., Arpit G. (2013) “Stock Prediction Using Twitter Sentiment Analysis.” Stanford University Computer Science Department.
[2]  Asif Perwej, Yusuf Perwej (2012). Prediction of the Bombay Stock Exchange (BSE) Market Returns Using Artificial Neural Network and Genetic Algorithm. Journal of Intelligent Learning Systems and Applications, pages 108-119.
[3]  Bar-Haim R., Dinur E., Feldman R., Fresko M., and Goldstein, G. (2011). Identifying and following expert investors in stock microblogs. In Proceedings of the Conference on Empirical Methods in Natural Language Processing, EMNLP ’11, pages 1310-1319, Stroudsburg, PA, USA. Association for Computational Linguistics.
[4]  Bollen, J., Mao H., and Zeng, X. (2011b). Twitter mood predicts the stock market. Journal of Computational Science, pp. 1-8.
[5]  Jared D. (2014) “Big Data, Data Mining and Machine Learning”. John Wiley & Sons, Inc.
[6]  Jiuzhen L., Wei S., and Mei W. (2011), “Stock Price Prediction Based on Procedural Neural Networks.” Department of Electrical Engineering, Jiangnan University, Wuxi 214122, China Advances in Artificial Neural Systems Volume 2011, Article ID 814769.
[7]  Kara Y., Acar B. & Baykan K. (2011). “Predicting direction of stock price index movement using artificial neural networks and support vector machines: The sample of the Istanbul Stock Exchange”. Expert systems with Applications; 38(5): 5311-5319.
[8]  Le T., Pang W., William C., Wei P., Ying Z. (2012). “Predicting Collective Sentiment Dynamics from Time-series Social Media.
[9]  Lipo W. & Shekhar G. (2013). “Neural Networks and Wavelet De-Noising for Stock Trading and Prediction”. Time Series Analysis, Modeling and Applications Volume 47 of the series Intelligent Systems Reference Library pp 229-247.
[10]  MathWorks (2015) Neural Network Toolbox. Retrieved from
[11]  Oxford Business Group (2013) Kenya looks to woo investors amid global stock market slowdown. Retrieved from
[12]  Rather, A.M. (2011). “A prediction based approach for stock returns using autoregressive neural networks. World Congress on Information and Communication Technologies (WICT), pp. 1271-1275.
[13]  Olatunji S.O., Mohammad S., Moustafa E. & Yaser A. (2013). “Forecasting the Saudi Arabia Stock Prices Based on Artificial Neural Networks Model.” International Journal of Intelligent Information Systems. Vol. 2, No. 5, pp. 77-86.
[14]  Senti Word Net (2011) About SentiWordNet. Retrieved from
[15]  Songbian Z. (2013) Africa Economic Growth Forecasting Research Based on Artificial Neural Network Model: Case Study of Benin. International Journal of Engineering Research & Technology (IJERT)ISSN: 2278-0181 Vol. 3 Issue 11
[16]  Stack Exchange (2013) Choosing the layers of hidden nodes in a neural network Retrieved from
[17]  Ryan Sangjun Lee, Gregery T. Buzzard and Peter H. Meckl (2012). “Optimal Parameter Estimation for Long- Term Prediction in the Presence of Model Mismatch”.
[18]  Suchira C. (2013). “An investigation into the use of neural networks for the prediction of the stock exchange of Thailand.
[19]  Tien Thanh Vu, Shu Chang, Quang Thuy Ha, Nigel Collier (2012) “An Experiment in Integrating Sentiment Features for Tech Stock Prediction in Twitter. Proceedings of the Workshop on Information Extraction and Entity Analytics on Social Media Data, pp 23-38.
[20]  Uma B., Sundar D., Alli P. (2013). An Optimized Approach to Predict the Stock Market Behavior and Investment Decision Making using Benchmark Algorithms for Naive Investors.
[21]  Stack Exchange (2016). What is the difference between training, validation and test set”. Retrieved from
[22]  César Souza (2009): Neural Network Learning by the Levenberg-Marquardt Algorithm with Bayesian Regularization. Retrieved from
[23]  Anais Collomb, Crina Costea, Damien Joyeux, Omar Hasan, Lionel Brunie (2015)A Study and Comparison of Sentiment Analysis Methods for Reputation Evaluation. University of Lyon.
[24]  Alessia D’Andrea, Fernando Ferri, Patrizia Grifoni, Tiziana Guzzo (2015). “Approaches, tools and Applications for Sentiment Analysis Implementation”. International Journal of Computer Applications. (0975-8887) Volume 125-No.3, September 2015.
[25]  Benard Nyangena Kiage (2015). A data mining approach for forecasting cancer threats. Published Masters thesis. Jomo Kenyatta University of Agriculture and Technology, Nairobi, Kenya.