This project implements a stock price prediction system using machine learning techniques, specifically LSTM neural networks. The system fetches historical stock data, processes it, trains a predictive model, and visualizes the predicted vs. actual stock prices.
Before running the code, ensure you have the following installed:
- Python 3.12
- Virtual environment (recommended)
- Required Python libraries listed in requirements.txt
- Clone the Repository:
git clone <repository_url>
- Create and Activate a Virtual Environment:
python -m venv stock_prediction_env
source stock_prediction_env/bin/activate # On Windows: stock_prediction_env\Scripts\activate
- Install Required Libraries:
pip install -r requirements.txt
- Run the Main Script:
python main.py
This script will:
- Load and preprocess stock data.
- Train the LSTM model.
- Make predictions on test data.
- Visualize the predicted and actual stock prices.
- Customize Parameters:
- Modify data_loading.py, model_training.py, or other modules to change stock symbols, training periods, model architecture, etc.
data_loading.py
Handles data fetching and preprocessing.model_training.py
: Builds and trains the LSTM model.prediction.py
: Generates predictions using the trained model.visualization.py
: Visualizes the prediction results.main.py
: Orchestrates the full workflow.