MachineLearning/lstm library

🔁 Long Short-Term Memory (LSTM)

A concise, well-documented LSTM cell and sequence model implementation. This module exposes a generic class with clear constructor arguments, fit and predict methods and strong doc comments describing input/output shapes, error modes, and complexity. The code is intentionally readable and prepared for extension into production-grade versions (e.g., vectorized kernels, regularization, checkpointing).

Contract:

  • Input: sequence batch X as List<List<List
  • Output: hidden states or per-sequence predictions as List<List
  • Errors: throws ArgumentError for invalid input shapes, StateError if used before fit

Time Complexity: O(n * t * m * hidden)

Classes

LSTM
Lightweight LSTM wrapper delegating trainable readout to ANN.