gopikrsmscs / stock-price-prediction-transformer

Tesal Stock Price Prediction Using Transformer
MIT License
6 stars 1 forks source link
stock-price-prediction tensorflow transformer transformers

Stock Price Prediction using Transformers

This project demonstrates how to predict stock prices using a Transformer model implemented with TensorFlow. It focuses on predicting Tesla's stock prices but can be adapted for any stock by changing the dataset.

Project Overview

The project uses a simplified Transformer architecture to forecast stock prices based on historical price data. It includes data loading, preprocessing, model training, prediction, and evaluation phases, with an emphasis on understanding the Transformer's application in time series forecasting.

Requirements

To run this project, you need the following libraries:

You can install these dependencies via pip:

pip install tensorflow pandas numpy scikit-learn matplotlib

Dataset

The dataset used in this project is Tesla's stock prices obtained from a CSV file named TSLA.csv. The CSV file should contain daily stock prices with at least the following columns: Date, Open, High, Low, Close, Volume.

Usage

1.Data Preparation: Place your TSLA.csv file in the project directory. 2.Model Training: Run the provided Python script to train the Transformer model on the stock price data. 3.Evaluation and Visualization: The script will evaluate the model's performance using RMSE and generate plots to visually compare the actual and predicted stock prices.

Code Structure

Results

After running the script, you will see a plot comparing the actual Tesla stock prices with the predictions made by the Transformer model. The console will also display the RMSE values for both the training and test datasets. Tesla Stock Prediction Results

Customization

You can customize the dataset, model architecture, and training parameters to predict other stocks or improve the model's accuracy.

License

This project is open-source and available under the MIT license.