This repository provides a full solution for predicting stock prices using an LSTM model. It includes a Jupyter Notebook for training and a Flask Web App for real-time predictions and visualization.
The project follows these main steps:
- 📥 Importing Libraries and Datasets: Load essential libraries and stock price data.
- 🧮 Pivoting the Data: Organize the data into a suitable format for analysis.
- 📈 Plotting Close Prices: Visualize the closing stock prices over time.
- 📉 Moving Averages: Compute and plot 10-day and 100-day moving averages.
- 🔄 Normalizing Data: Scale data using MinMaxScaler for better LSTM training.
- 🧠 LSTM Model: Train a Long Short-Term Memory (LSTM) neural network.
- 💾 Model Saving: Save the trained model as
lstm.pkl
usingjoblib
. - 🌐 Deployment: Build a user-friendly Flask web app to display predictions interactively.
Install the necessary Python libraries with or simply refer requirements.txt:
pip install numpy pandas matplotlib scikit-learn tensorflow keras flask joblib
git clone https://github.com/yourusername/stock-price-predictor.git
cd stock-price-predictor
- Open the Jupyter Notebook:
jupyter notebook
- Run the cells to:
- Load and process stock data
- Train the LSTM model
- Save the trained model as
lstm.pkl
- Ensure
lstm.pkl
is present in the same directory asapp.py
. - Run the Flask app:
python app.py
- Open your browser and go to:
👉http://localhost:5000
Contributions are welcome! Feel free to fork the repo and submit pull requests for improvements or new features.
This project is licensed under the MIT License.