This repository contains a simplified implementation of a Transformer model for time series prediction. The purpose of this project is to provide an easy-to-understand example of how Transformer models can be applied to time series data, making it accessible for beginners.
- Simple implementation with minimal files
- Generates random input data for demonstration purposes
- Allows users to save the trained model
- Clear and concise code to facilitate learning
-
Clone the repository:
git clone https://github.com/Zdong104/TimeSeriesTransformer.git cd TimeSeriesTransformer
-
Install Miniconda:
Miniconda is a minimal installer for conda. You can download and install it from the Miniconda website. Scroll to the button, use Quick install.
After downloading the installer, run it and follow the instructions to complete the installation.
-
Create a virtual environment and activate it:
conda create --name transformer-ts python=3.8 conda activate transformer-ts
-
Install the required packages:
pip install numpy torch
-
Run the training script:
python TimeSeriesTransformer.py
This script will:
- Generate random input data
- Train the Transformer model on this data
- Save the trained model to a file
-
You can modify the
TimeSeriesTransformer.py
script to use your own time series data by replacing the random data generation section.
Contributions are welcome! If you have any suggestions, bug reports, or improvements, please open an issue or submit a pull request.
No License, if you like it give me a star 🌟