How omerbsezer/lstm_rnn_tutorials_with_demo works
Project type and purpose
• This repo is an educational “Sequential Models” tutorial that demos basic RNN/LSTM building blocks plus four sample end-to-end projects:
• BasicRNN (toy implementation)
• BasicLSTM (toy implementation)
• StockPricesPredictionProject
• SentimentAnalysisProject
• MusicGenerationProject
• The root README explains the goal: teach RNN/LSTM concepts via code, from cell math up through real-world demos.
File structure
• Top-level directories are one per demo. Each contains:
• main script(s) (e.g. main.py or pricePredictionLSTM.py)
• utility modules (rnn_utils.py, data_utils.py, emo_utils.py, music_utils.py, midi.py, grammar.py, etc.)
• local data (CSV files, .mid files, preprocessed caches, output subfolders)
• No single “frontend/backend” split—each demo is a standalone pipeline.
• Shared pattern: Data → Preprocess → Model Definition → Train → Inference → Output.
README for architecture clues
• Each demo uses Keras/TensorFlow under the hood.
• External data sources: Yahoo Finance CSV, Kaggle GloVe embeddings, music21 toolkit for MIDI parsing.
• Each project follows the same LSTM structure but with different data types.
Main components and interactions
a. Shared core layer (center):
– RNN utilities (BasicRNN/rnn_utils.py)
– LSTM utilities (BasicLSTM/rnn_utils.py)
– Data-preprocessing utilities (data_utils.py, emo_utils.py, music_utils.py)
– Grammar & MIDI helpers (grammar.py, midi.py)
b. Four demo pipelines (clustered around the core):
1) Stock Predictor
• Input: DIS.csv (finance.yahoo.com)
• Preprocess: normalize, windowing
• Model: Keras LSTM (25 units)
• Output: lstm_result.csv, price plot
2) Sentiment Emojifier
• Input: train_emoji.csv/test_emoji.csv (local)
• Preprocess: Glove embeddings (external Kaggle file)
• Model: Keras LSTM classifier
• Output: emoji predictions, confusion results
3) Music Generator
• Input: original_metheny.mid (music21 toolkit)
• Preprocess: one-hot sequence (Tx=30, n_values=78)
• Model: stacked LSTM, inference model
• Output: my_music.midi
4) Basic RNN/LSTM demos
• Input: toy sequences
• Preprocess & model: manual forward/backward implementations
• Output: console logs, unit-test style outputs
c. External services & data stores (placed outside system boundary):
– Yahoo Finance CSV
– Kaggle GloVe vectors
– music21 toolkit / MIDI files
– Python environment (Keras, TensorFlow)
Architectural patterns & design principles
• Layered pipeline per demo:
Data Layer → Preprocess Layer → Model Layer → Training/Inference Layer → Output Layer
• Reuse via shared utilities (DRY)
• Directory-per-demo isolation (modular, pluggable)
• Consistent LSTM/RNN abstraction across demos