# debopriya-ai/feel-the-words architecture

> Architecture diagram of the GitHub repository debopriya-ai/feel-the-words, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-07-16). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/debopriya-ai/feel-the-words
- Repository: https://github.com/debopriya-ai/feel-the-words

## Overview

##### Project type and purpose
- This is an NLP research/demo pipeline contained in a single Jupyter notebook.
- Purpose: perform precision sentiment classification on the IMDB dataset using two parallel model paths:
a) a fully custom PyTorch RNN built from scratch, and
b) a fine-tuned fastai AWD_LSTM.
- Emphasis on manual hidden-state handling, dropout regularization, tokenization, custom data loaders, and transfer learning.

##### File structure
- Top level has only a single notebook (`RNN_NLP_LAB (1).ipynb`), plus LICENSE and README.
- All code, data ingestion, preprocessing, model definitions, training loops, and evaluation live inside that notebook.
- No separate “src” or “config” directories—everything is modularized in notebook cells.

##### Extract key architecture details from the README
- Two modeling “paths”: handcrafted RNN vs. fastai AWD_LSTM.
- Shared preprocessing: tokenization, numericalization, batching via custom loader.
- Shared evaluation metrics and comparison stage.
- Tech stack: Python + Jupyter, PyTorch, fastai, IMDB dataset.

##### Main components
A. Data Source
- IMDB raw text dataset (probably loaded via fastai’s DataBlock or custom Pandas loader).
B. Preprocessing Module
- Tokenizer & numericalizer
- Custom PyTorch DataLoader with dropout at the batch level
C. Dual Modeling Pipelines
1. Custom PyTorch RNN
– RNN cell architecture (embedding → recurrent layers → linear classifier)
– Manual hidden-state initialization & dropout between steps
– Training loop (loss computation, backprop)
2. fastai AWD_LSTM
– Pretrained language model head
– Fine-tuning strategy (gradual unfreezing, discriminative learning rates)
– fastai Learner wrapper for training & callbacks
D. Evaluation & Comparison
– Accuracy computation for each model
– Visualization of training/validation curves
– Final performance table (92.3% vs. 85.1%)

##### Relationships and data flow
- From Evaluation → Results & Visualization.

##### Architectural patterns and design principles
- Dual-path architecture facilitates direct compare/contrast.
- Reuse of preprocessing logic to ensure fair comparison.
- Separation of concerns: data ingestion, preprocessing, modeling, evaluation.
- Transfer learning vs. from-scratch modeling side by side.

##### Technologies & libraries to annotate
- Python / Jupyter environment (outer container)
- fastai (AWD_LSTM path)
- PyTorch core (custom RNN path)
- IMDB dataset source (could note Hugging Face or local CSV)
- Custom DataLoader (dropout, batching)

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph "Jupyter Notebook"
        direction TB
        DS["Data Source\n(IMDB Dataset)"]:::data
        PP["Preprocessing Module\n(Tokenization, Numericalization, Custom DataLoader)"]:::preprocess
        RNN["Custom PyTorch RNN Path\n(RNN cell, hidden‐state handling, training loop)"]:::pytorch
        AWD["fastai AWD_LSTM Path\n(Pretrained AWD_LSTM fine-tuning, Learner & callbacks)"]:::fastai
        EVAL["Evaluation & Comparison\n(Accuracy, training/validation curves, results table)"]:::eval
    end

    DS -->|"raw text"| PP
    PP -->|"batches"| RNN
    PP -->|"batches"| AWD
    RNN -->|"metrics"| EVAL
    AWD -->|"metrics"| EVAL

    MD["Project Metadata & Instructions\n(README.md)"]:::external
    LIC["License Information\n(LICENSE)"]:::external

    MD -.-> DS
    LIC -.-> DS

    click DS "https://github.com/debopriya-ai/feel-the-words/blob/main/RNN_NLP_LAB (1).ipynb"
    click PP "https://github.com/debopriya-ai/feel-the-words/blob/main/RNN_NLP_LAB (1).ipynb"
    click RNN "https://github.com/debopriya-ai/feel-the-words/blob/main/RNN_NLP_LAB (1).ipynb"
    click AWD "https://github.com/debopriya-ai/feel-the-words/blob/main/RNN_NLP_LAB (1).ipynb"
    click EVAL "https://github.com/debopriya-ai/feel-the-words/blob/main/RNN_NLP_LAB (1).ipynb"
    click MD "https://github.com/debopriya-ai/feel-the-words/blob/main/README.md"
    click LIC "https://github.com/debopriya-ai/feel-the-words/tree/main/LICENSE"

    classDef data fill:#bbf,stroke:#333,stroke-width:1px
    classDef preprocess fill:#bfb,stroke:#333,stroke-width:1px
    classDef pytorch fill:#88f,stroke:#333,stroke-width:1px
    classDef fastai fill:#8f8,stroke:#333,stroke-width:1px
    classDef eval fill:#ffb,stroke:#333,stroke-width:1px
    classDef external fill:#eee,stroke:#666,stroke-dasharray: 2 2
```
