Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/phongct1105/s-p_500_stock_prediction
Advanced Stock Price Prediction Tool using ARIMA and LSTM models with a Streamlit-based web interface for visualization and analysis.
https://github.com/phongct1105/s-p_500_stock_prediction
arima deep-learning financial-forecasting lstm machine-learning python stock-price-prediction streamlit time-series
Last synced: 9 days ago
JSON representation
Advanced Stock Price Prediction Tool using ARIMA and LSTM models with a Streamlit-based web interface for visualization and analysis.
- Host: GitHub
- URL: https://github.com/phongct1105/s-p_500_stock_prediction
- Owner: PhongCT1105
- License: mit
- Created: 2024-11-07T01:10:45.000Z (3 months ago)
- Default Branch: main
- Last Pushed: 2025-01-05T03:29:29.000Z (about 1 month ago)
- Last Synced: 2025-01-05T04:20:34.796Z (about 1 month ago)
- Topics: arima, deep-learning, financial-forecasting, lstm, machine-learning, python, stock-price-prediction, streamlit, time-series
- Language: Jupyter Notebook
- Homepage: https://stockpredictsp500.streamlit.app/
- Size: 7.69 MB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# 📈 Stock Price Prediction with ARIMA and LSTM Models
This project demonstrates the use of traditional time series models (ARIMA) and deep learning models (LSTM) for predicting stock prices. It integrates data preprocessing, model training, and deployment into a user-friendly Streamlit web application.
## ✨ Features
- **📊 Data Source**: Historical stock price data retrieved using the `yfinance` Python library.
- **🎯 Target Variable**: Closing prices of stocks in the S&P 500 index.
- **📂 Models**:
- **ARIMA**: Traditional time series model for short-term forecasts.
- **LSTM**: Deep learning model for capturing non-linear trends and long-term dependencies.
- **🌐 Web Interface**: Interactive Streamlit app for model visualization and comparison.## 🔄 Project Workflow
### 1. 🛠️ Data Preprocessing
- Data normalized using `MinMaxScaler`.
- Sliding window of 60 days used to create input-output sequences for LSTM.
- Stationarity achieved using differencing for ARIMA.### 2. 📘 Modeling Approaches
- **ARIMA**:
- Hyperparameter selection via MINIC and ESACF methods.
- Focused on short-term accuracy but struggled with non-linear patterns.
- **LSTM**:
- Two LSTM layers with dense layers for output.
- Used Adam optimizer and Mean Squared Error (MSE) loss.
- Outperformed ARIMA in both short-term and long-term forecasting.### 3. 🚀 Deployment
- Deployed on a Streamlit web app for interactive stock selection and prediction visualization.## 🧩 Challenges and Solutions
- **ARIMA**:
- Required data stationarity through extensive preprocessing.
- Manual hyperparameter tuning using grid search and AIC.
- **LSTM**:
- Overfitting resolved by adding dropout layers.
- Computationally intensive, requiring significant hardware.## 📊 Results
- **📈 Metrics**:
- LSTM: MAE = 2.34, MSE = 8.92, R² = 0.87.
- LSTM outperformed ARIMA, excelling in capturing non-linear trends and volatility.## 🚀 How to Run
1. Clone the repository:
```bash
git clone https://github.com/your_username/your_project.git
cd your_project
```
2. Install dependencies:
```bash
pip install -r requirements.txt
```
3. Run the Streamlit app:
```bash
streamlit run app.py
```## 🌟 Future Directions
- Incorporate external factors like macroeconomic indicators and sentiment analysis.
- Explore advanced models (e.g., Transformers) for improved predictions.
- Combine ARIMA and LSTM in hybrid models.## 🌐 Live Demo
Check out the deployed web app: [Stock Price Predictor](https://stockpredictsp500.streamlit.app/)