# lingadeu/sentiment-model-experiment architecture

> Architecture diagram of the GitHub repository lingadeu/sentiment-model-experiment, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-12). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/lingadeu/sentiment-model-experiment
- Repository: https://github.com/lingadeu/sentiment-model-experiment

## Overview

##### Project type and purpose
- This is a data-science / machine-learning research project that builds and compares several sentiment-analysis models (conventional ML, LSTM, and fine-tuned IndoBERT) on product reviews from Tokopedia.
- The goal is to automate extraction of binary sentiment (positive/negative) and to compare performance across vectorizer+ML, RNN, and transformer-based approaches.

##### File structure
- Top level:
- data/ — raw and cleaned CSV files
- notebook/ — series of Jupyter notebooks for analysis and experiments (01_analysis, 02_tfidf-and-ml-models, 03_tfidf-and-lstm, 04_embeddings-and-IndoBERT)
- model/ — serialized artifacts from best conventional ML experiments (.pkl) and notes about the HuggingFace-hosted IndoBERT model
- img/ — supporting images (e.g., header.png)
- README.md and .gitignore
- No web frontend or server code—this is a modeling pipeline rather than a deployed service.

##### README for additional insights
- README outlines three experimental paths:
a. Quantitative text analysis & exploration
b. Conventional ML with TF-IDF + SVM
c. Deep-learning LSTM
d. Transformer fine-tuning (IndoBERT) stored on HuggingFace
- It describes key results, dependencies (e.g., scikit-learn, TensorFlow/PyTorch, HuggingFace Transformers), and folder organization.

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Data Stage"
        Raw[(PRDECT-ID Dataset.csv)]:::data
        Clean[(cleaned_data.csv)]:::data
    end

    subgraph "Preprocessing"
        Pre[/"01_analysis.ipynb"/]:::preprocess
    end

    Raw --> Clean
    Clean --> Pre
    Pre --> Feature["Feature Matrices"]:::preprocess

    subgraph "Modeling Pipelines"
        subgraph "Conventional ML"
            Tfidf["TF-IDF + SVM Training"]:::model
            Cal[("best_model_tfidf.pkl")]:::storage
            Cal2[("calib_best_model_tfidf.pkl")]:::storage
            Feature --> Tfidf --> Cal
            Tfidf --> Cal2
        end

        subgraph "RNN Pipeline"
            RNN["LSTM Training"]:::model
            Feature --> RNN
        end

        subgraph "Transformer Pipeline"
            Trans["IndoBERT Fine-Tuning"]:::model
            Clean --> Trans
        end
    end

    subgraph "Storage & Registry"
        LocalModel[(model/)]:::storage
        Hf[("HuggingFace Model Repo")]:::external
        Cal --> LocalModel
        Cal2 --> LocalModel
        Trans --> Hf
    end

    subgraph "Evaluation & Visualization"
        Eval["Evaluation & Charts"]:::preprocess
        Tfidf --> Eval
        RNN --> Eval
        Trans --> Eval
    end

    subgraph "External Services"
        GH["GitHub Repo"]:::external
        NBViewer["nbviewer"]:::external
        GH --> Raw
        GH --> Pre
        GH --> Tfidf
        GH --> RNN
        GH --> Trans
        NBViewer --> Pre
    end

    subgraph "Project Documentation"
        Readme["README.md"]:::external
        Img["img/"]:::external
    end

    click Raw "https://github.com/lingadeu/sentiment-model-experiment/blob/main/data/PRDECT-ID Dataset.csv"
    click Clean "https://github.com/lingadeu/sentiment-model-experiment/blob/main/data/cleaned_data.csv"
    click Pre "https://github.com/lingadeu/sentiment-model-experiment/blob/main/notebook/01_analysis.ipynb"
    click Tfidf "https://github.com/lingadeu/sentiment-model-experiment/blob/main/notebook/02_tfidf-and-ml-models.ipynb"
    click Cal "https://github.com/lingadeu/sentiment-model-experiment/blob/main/model/best_model_tfidf.pkl"
    click Cal2 "https://github.com/lingadeu/sentiment-model-experiment/blob/main/model/calib_best_model_tfidf.pkl"
    click RNN "https://github.com/lingadeu/sentiment-model-experiment/blob/main/notebook/03_tfidf-and-lstm.ipynb"
    click Trans "https://github.com/lingadeu/sentiment-model-experiment/blob/main/notebook/04_embeddings-and-IndoBERT.ipynb"
    click LocalModel "https://github.com/lingadeu/sentiment-model-experiment/tree/main/model/"
    click Readme "https://github.com/lingadeu/sentiment-model-experiment/blob/main/README.md"
    click Img "https://github.com/lingadeu/sentiment-model-experiment/tree/main/img/"

    classDef data fill:#ADD8E6,stroke:#000;
    classDef preprocess fill:#90EE90,stroke:#000;
    classDef model fill:#FFA500,stroke:#000;
    classDef storage fill:#DA70D6,stroke:#000;
    classDef external fill:#D3D3D3,stroke:#000;
```
