This project predicts stock prices using historical data and a machine learning model. It includes a linear regression model trained on stock features and a GUI application for real-time predictions.
- Stock Data Fetching: Retrieves historical stock data using Yahoo Finance API.
- Feature Engineering: Adds moving averages, lagged values, and performs data preprocessing.
- Machine Learning Model: Uses Linear Regression for stock price prediction.
- Evaluation Metrics: Calculates MAE, RMSE, and R² scores to evaluate model performance.
- Visualization: Plots actual vs. predicted stock prices.
- Interactive GUI: A PyQt5-based interface allows users to input a company ticker symbol and get stock price predictions.
- Python 3.8 or higher
- Install the required dependencies:
pip install -r requirements.txt
The following libraries are required:
- yfinance
- pandas
- scikit-learn
- matplotlib
- PyQt5
- numpy
- ex. pip install yfinance
Clone the repository:
git clone https://github.com/StockSense-AI/StockSense-AI-Full-Code-
- cd StockSense-AI-Full-Code-
- Install dependencies:
pip install -r requirements.txt - Set up the project: Ensure that the
Stock_Predictor.pyandStock_PredictorGUI.pyfiles are in the same directory. - Launch the GUI:
python Stock_PredictorGUI.py- Input a stock ticker (e.g., AAPL) in the provided text field.
- Click "Predict Stock Price" to get predictions.
- Stock_Predictor.py : Contains the core functionality for data fetching, preprocessing, model training, and evaluation.
- Stock_PredictorGUI.py : Contains the PyQt5-based GUI for user interaction.
- Fetch stock data using Yahoo Finance API.
- Engineer features such as moving averages and lagging indicators, then clean the data.
- Split the data into training and testing sets.
- Train a linear regression model on the training data.
- Evaluate the model using metrics (MAE, RMSE, and R²).
- Display the predictions in the GUI and visualize actual vs. predicted prices.
The project visualizes the model's performance by plotting actual vs. predicted stock prices. The GUI includes a feature to view these results graphically.
- Add support for additional machine learning models (e.g., Random Forest, Neural Networks).
- Implement advanced preprocessing techniques for improved predictions.
- Enhance the GUI with more user-friendly features and detailed visualizations.
- Makari Green
- Danny Adebiyi
Developers and maintainers of the Stock Price Predictor project.