Stock Prediction Using LSTM and Linear Regression with Anomaly Detection and Sentiment Analysis
DOI:
https://doi.org/10.26438/ijcse/v13i5.18Keywords:
Stock Market Prediction, LSTM, Linear Regression,, Sentiment Analysis, Anomaly Detection,, Investment Recommendation, Time Series Forecastin, Financial News Analysis, Volatility Estimatio, Deep Learnin, TextBlob, Hybrid Model, Portfolio Optimization,, Market Crash Detection.Abstract
This research introduces a hybrid framework for stock market prediction that combines Long Short-Term Memory (LSTM) networks, linear regression, sentiment analysis, and anomaly detection into a single system. Historical OHLCV data is used to train the LSTM model to capture complex temporal trends, while a linear regression layer smooths the output to reduce sensitivity to short-term noise. To enrich numerical features, sentiment scores are extracted from daily financial news headlines using TextBlob, enabling the model to account for psychological and event-driven market behavior. An anomaly detection module calculates the standard deviation of daily returns and annualizes it using ?252 to identify volatility spikes that may signal market instability. The integrated system achieves a high prediction accuracy of 96.2%, outperforming several existing models in both short- and long-term forecasts. Beyond prediction, the system provides actionable investment recommendations. It evaluates predicted returns and volatility across stocks, then optimizes fund allocation based on a user`s budget to maximize expected gains while minimizing risk. Extensive back-testing demonstrates the model’s robustness, adaptability, and practical value. Deployed as a web-based tool, this comprehensive solution empowers investors and researchers with a multidimensional, data-driven approach to navigate the complexity and volatility of financial markets effectively.
References
[1] Y. Tang, S. Wang, and Y. Zhang, “Prediction of Financial Time Series Based on LSTM Using Wavelet Transform and Singular Spectrum Analysis,” Mathematical Problems in Engineering, Vol.2021, pp.1–12, 2021.
[2] S. Singh and V. Kumar, “Stock Market Prediction Using News Sentiment Analysis: A Hybrid Approach,” International Journal of Data Science and Analytics, Vol.13, Issue.2, pp.123–135, 2022.
[3] T. Nguyen, M. Tran, and D. Pham, “Deep Learning-Based Framework for Portfolio Optimization Using Market Predictions,” Computational Economics, Vol.60, Issue.3, pp.487–502, 2022.
[4] G. Zhang, X. Liu, and Y. Liu, “Stock Price Prediction Using Deep Learning and Frequency Decomposition,” Expert Systems with Applications, Vol.169, pp.1–10, 2021.
[5] J. Zhang, K. Li, and S. Wang, “An Improved Deep Learning Model for Predicting Stock Market Price Time Series,” Digital Signal Processing, Vol.102, pp.1–8, 2020.
[6] X. Zhang, G. Wang, and Y. Zhang, “Stock Index Prediction Based on Time Series Decomposition and Hybrid Model,” Entropy, Vol.24, Issue.2, pp.1–14, 2022.
[7] B. Liu, J. Wang, and L. Zhao, “Series Decomposition Transformer with Period-Correlation for Stock Market Index Prediction,” Expert Systems with Applications, Vol.213, pp.1–12, 2023.
[8] Y. Wang, D. Zhang, and X. Zhu, “A Hybrid Model for Stock Price Prediction Using Long Short-Term Memory and Generative Adversarial Networks,” Journal of Forecasting, Vol.40, Issue.8, pp.1418–1432, 2021.
[9] Y. Chen, Y. Qian, and X. Liu, “Stock Market Forecasting Using Machine Learning Algorithms,” Artificial Intelligence in Finance, Vol.2, Issue.1, pp.1–10, 2020.
[10] W. Huang, Y. Nakamori, and S. Y. Wang, “Forecasting Stock Market Movement Direction with Support Vector Machine,” Computers & Operations Research, Vol.27, Issue.10, pp.1001–1012, 2020.
Downloads
Published
How to Cite
Issue
Section
License

This work is licensed under a Creative Commons Attribution 4.0 International License.
Authors contributing to this journal agree to publish their articles under the Creative Commons Attribution 4.0 International License, allowing third parties to share their work (copy, distribute, transmit) and to adapt it, under the condition that the authors are given credit and that in the event of reuse or distribution, the terms of this license are made clear.
