Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Long Short-Term Memory (LSTM) RNN from Scratch in NumPy

A 2D Long Short-Term Memory (LSTM) Recurrent Neural Network framework implemented from first principles in NumPy, without relying on PyTorch or TensorFlow for model operations or automatic differentiation.

This project was originally created upon finishing high school as an early programming project to learn Python and understand recurrent neural network mathematics and Backpropagation Through Time (BPTT). The original unedited state is tagged as v0.1.0-legacy (commit 771d128) and preserved in legacy/original_lstm.py. The repository contains both that legacy script and a modernized refactor with modular layer abstractions, type annotations, unit tests, and fused matrix gate acceleration.


Visualizations

Sequence Forecast Predictions

Comparing ground truth signals with LSTM sequence predictions:

Sequence Forecast Predictions

Achieves MSE loss < 0.01 on sequence prediction.


Quickstart & Usage

This project uses uv for dependency management.

  1. Install dependencies:
uv sync
  1. Run the train script:
uv run train.py

About

Implementation of LSTM RNN from scratch

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages