Time Series Forecasting using LSTM📈
Image generated by ChatGPT
This repository demonstrates time series forecasting using a Long Short-Term Memory (LSTM) model. The main objective is to predict future trajectories based on historical data.
🛠How to Set Up and Replicate
Clone the Repository:
1 2
git clone https://github.com/AKR-2803/pytorch-time-series-forecasting cd pytorch-time-series-forecasting
Install required dependencies: You can install all the necessary dependencies using the
requirements.txt
file:1
pip install -r requirements.txt
Dataset: The dataset can be downloaded from here
When trying to run
model.ipynb
locally, replace this1 2 3 4 5 6 7 8
import os train_path = os.path.join("/kaggle/input/cse-575-project-2/train.csv") val_path = os.path.join("/kaggle/input/cse-575-project-2/val.csv") test_path = os.path.join("/kaggle/input/cse-575-project-2/test.csv") train_df = pd.read_csv(train_path, header=0).drop('ids', axis=1) val_df = pd.read_csv(val_path, header=0).drop('ids', axis=1) test_df = pd.read_csv(test_path, header=0).drop('ids', axis=1)
with
1 2 3 4 5 6 7
train_path = "dataset/train.csv" val_path = "dataset/val.csv" test_path = "dataset/test.csv" train_df = pd.read_csv(train_path, header=0).drop('ids', axis=1) val_df = pd.read_csv(val_path, header=0).drop('ids', axis=1) test_df = pd.read_csv(test_path, header=0).drop('ids', axis=1)
Make sure to replace all file paths, such as
"dataset/train.csv"
, with your appropriate system paths.Ensure the
dataset
(containingtrain.csv
,val.csv
, andtest.csv
) folder is placed in the same directory asmodel.ipynb
. This ensures the code can correctly locate the files when executed locally.
Output
The following output images display the results of the LSTM model’s predictions on the first three trajectory instances: