Skip to content

Latest commit

Β 

History

4 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 

Repository files navigation

Time Series Forecasting using LSTM and Transformer This repository presents a comparative study of time series forecasting using Long Short-Term Memory (LSTM) networks and Transformer-based architectures. The project focuses on predicting sequential numerical data (e.g., stock prices) and evaluating the strengths and limitations of each model.

πŸš€ Project Overview

Time series forecasting is a critical task in finance, economics, and operations. Traditional RNN-based models like LSTM handle sequential dependencies well, while Transformer models leverage self-attention to capture long-range temporal patterns more effectively.

This project: Implements LSTM and Transformer models from scratch Trains both models on the same dataset Compares their performance using standard regression metrics Demonstrates practical trade-offs in accuracy, training time, and scalability

🧠 Models Implemented

  1. LSTM (Long Short-Term Memory) Captures temporal dependencies using gated recurrent units Effective for small-to-medium time horizons Sequential processing (slower on large datasets)
  2. Transformer Uses self-attention instead of recurrence Handles long-range dependencies efficiently Parallelizable and scalable for large datasets πŸ“‚ Repository Structure β”œβ”€β”€ time_series_code.ipynb # Main notebook with data preprocessing, training, and evaluation β”œβ”€β”€ README.md # Project documentation β”œβ”€β”€ requirements.txt # Python dependencies (optional) └── data/ # Dataset (if applicable)

βš™οΈ Installation & Setup Clone the repository: git clone https://github.com/your-username/time-series-forecasting.git cd time-series-forecasting (Optional) Create a virtual environment: python -m venv venv source venv/bin/activate Install dependencies: pip install -r requirements.txt Open the notebook: jupyter notebook time_series_code.ipynb

πŸ§ͺ Experiment Pipeline Data loading and cleaning Feature scaling and windowing Train–test split Model training (LSTM & Transformer) Prediction and visualization Performance evaluation πŸ“Š Evaluation Metrics Mean Absolute Error (MAE) Mean Squared Error (MSE) Root Mean Squared Error (RMSE) πŸ“ˆ Results Summary Model Strengths Limitations LSTM Stable, interpretable, good for short trends Slower training, limited long-term memory Transformer Captures long-term patterns, scalable Higher computational cost (Exact numerical results are available in the notebook.) πŸ› οΈ Technologies Used Python NumPy, Pandas TensorFlow / PyTorch Scikit-learn Matplotlib / Seaborn Jupyter Notebook 🎯 Key Learnings Transformers outperform LSTMs on longer sequences Attention mechanisms reduce information loss Data preprocessing significantly impacts forecasting accuracy

πŸ‘€ Author Rushikesh Iname πŸ“ Bengaluru, India πŸ’Ό Data & AI Engineer

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages