๐ A deep learning approach to predict stock market prices using LSTM (Long Short-Term Memory) networks.
This project implements an LSTM-based deep learning model to predict stock market prices. We analyze historical data from multiple assets (AMZN, DPZ, BTC, NFLX) to forecast future price movements, helping investors make data-driven decisions.
- ๐ฎ Multi-asset price prediction with LSTM networks
- ๐ Real-time visualization of training progress
- ๐ Comprehensive performance metrics and analysis
- ๐งช Interactive Jupyter notebook implementation
- ๐ Robust data preprocessing pipeline
- ๐ค Advanced LSTM architecture with dropout layers
Actual vs Predicted prices for target asset
Load Data โ Preprocess โ Create Sequences โ Scale โ Train/Test Split
- Input Layer: Sequence length of 60 timesteps
- LSTM Layer 1: 128 units with dropout
- LSTM Layer 2: 64 units with dropout
- Dense Output Layer: Multi-asset prediction
- Handles missing values automatically
- Implements MinMax scaling
- Creates sliding window sequences
- Performs train-test splitting
- Sequence Length: 60 days
- Test Split: 20%
- Batch Size: 32
- Learning Rate: Adaptive (with ReduceLROnPlateau)
- Early Stopping: Patience of 15 epochs
-
Clone the Repository
git clone https://github.com/shretadas/Stock-Price-Prediction-using-LSTM.git cd Stock-Price-Prediction-using-LSTM -
Install Dependencies
pip install -r requirements.txt
-
Run the Jupyter Notebook
jupyter notebook Stock_Price_Prediction.ipynb
This visualization shows the historical price movements of our target assets. The multi-line plot demonstrates the diverse patterns and correlations between different stocks in our portfolio, highlighting the complexity our LSTM model needs to handle.
The training history graph displays the model's learning progression. The convergence of loss metrics indicates successful training, while the validation curves help us monitor and prevent overfitting.
Comparison between predicted (orange) and actual (blue) stock prices. The close alignment of these curves demonstrates our model's ability to capture both trends and subtle price movements.
Our most recent market analysis showing real-time predictions alongside actual market data. This visualization helps traders make informed decisions based on the model's forecasts.
โจ Mean Squared Error (MSE): Consistently low across test data
๐ Trend Accuracy: >85% directional prediction
๐ฏ Price Prediction: High precision in 5-day forecasts
๐ Adaptation: Robust performance across market conditions
- The model excels at capturing both short-term fluctuations and long-term trends
- Performance remains stable across different market volatility levels
- Real-time predictions provide actionable trading signals
- Multi-asset analysis reveals inter-market correlations
- TensorFlow 2.x
- Python 3.x
- Pandas
- NumPy
- Matplotlib
- Scikit-learn
Stock-Price-Prediction-using-LSTM/
โ
โโโ data/
โ โโโ portfolio_data.csv
โ
โโโ images/
โ โโโ historical_prices.png
โ โโโ training_progress.png
โ โโโ predictions.png
โ
โโโ models/
โ โโโ best_model.h5
โ
โโโ Stock_Price_Prediction.ipynb
โโโ requirements.txt
โโโ README.md
- Multi-asset price prediction
- Real-time training visualization
- Automatic data preprocessing
- Model checkpoint saving
- Performance visualization
- Error analysis
Contributions are welcome! Please feel free to submit a Pull Request.
This project is licensed under the GNU General Public License v3.0 - see the LICENSE file for details.