# aashish2502/comment_classifier architecture

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

- Interactive diagram: https://gitdiagram.com/aashish2502/comment_classifier
- Repository: https://github.com/aashish2502/comment_classifier

## Overview

##### Project type and purpose
- This is a data-science / machine-learning pipeline implemented in a single Jupyter Notebook (`Comment_Classification.ipynb`) whose purpose is to classify social-media comments as toxic or non-toxic and further subtype the toxicity (insult, threat, identity attack, etc.).

##### File structure
- Top-level items only:
- `Comment_Classification.ipynb` (the orchestrating notebook)
- `README.md` (project overview, dependencies, model descriptions)
- `LICENSE`
- No separate “src” or “lib” folders. All code, data-prep, model training and evaluation live in the notebook.

##### README for additional insights
- Dependencies include Pandas, Numpy, Matplotlib, Seaborn, Scikit-Learn, Pickle, NLTK, Wordcloud.
- Four classifiers are compared: Multinomial Naive Bayes, Linear SVC, XGBoost, Logistic Regression.
- Data is ingested from a Kaggle dataset (CSV), then split into train/test.

a. Main components
- Data Ingestion (CSV reader, train/test split)
- Preprocessing (text cleaning, tokenization with NLTK, stop-word removal)
- Feature Extraction (CountVectorizer / TF-IDF)
- Model Evaluation (precision/recall/F1, comparison charts)
- Model Persistence (Pickle serialization)

b. Relationships & interactions

c. Architectural patterns / design principles
- Pipeline pattern: each stage passes transformed data to the next
- Modular design: treat each classifier as an interchangeable module
- Reproducibility: notebook orchestrates the entire flow, environment captured by dependencies

d. Key technologies / frameworks
- Jupyter Notebook (orchestration)
- Pandas, Numpy (data manipulation)
- NLTK (text preprocessing)
- Scikit-Learn (vectorizers, classifiers, metrics)
- XGBoost (gradient boosting)
- Pickle (model serialization)
- Matplotlib / Seaborn (visualizations)
- Wordcloud (EDA)

##### Essential architectural elements to capture
- The end-to-end pipeline flow from raw CSV to a serialized model.
- The four parallel classifier modules feeding into a comparison/evaluation stage.
- The role of the notebook as the orchestrator.
- The technologies at each step (vectorizer, classifier library, plotting).

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Orchestrator
    Notebook["Orchestrator Notebook\n(Jupyter)"]:::orchestrator
    click Notebook "https://github.com/aashish2502/comment_classifier/blob/main/Comment_Classification.ipynb"

    %% External resources
    Dataset["Dataset (CSV from Kaggle)"]:::external
    README["Project Overview\n& Dependencies"]:::external
    click README "https://github.com/aashish2502/comment_classifier/blob/main/README.md"

    %% Pipeline stages
    DataIngest["Data Ingestion\n(CSV reader, train/test split)\n(Pandas)"]:::dataStage
    Preprocess["Preprocessing\n(text cleaning, tokenization, stop-word removal)\n(NLTK)"]:::dataStage
    Feature["Feature Extraction\n(CountVectorizer/TF-IDF)\n(Scikit-Learn)"]:::dataStage

    subgraph "Model Training" 
        NB["Multinomial Naive Bayes"]:::modelStage
        SVC["Linear SVC"]:::modelStage
        XGB["XGBoost"]:::modelStage
        LR["Logistic Regression"]:::modelStage
    end

    Eval["Model Evaluation\n(precision, recall, F1)\n(Matplotlib, Seaborn, Wordcloud)"]:::modelStage
    Persist["Model Persistence\n(Pickle serialization)"]:::persistStage

    %% Click events for notebook stages
    click DataIngest "https://github.com/aashish2502/comment_classifier/blob/main/Comment_Classification.ipynb"
    click Preprocess "https://github.com/aashish2502/comment_classifier/blob/main/Comment_Classification.ipynb"
    click Feature "https://github.com/aashish2502/comment_classifier/blob/main/Comment_Classification.ipynb"
    click NB "https://github.com/aashish2502/comment_classifier/blob/main/Comment_Classification.ipynb"
    click SVC "https://github.com/aashish2502/comment_classifier/blob/main/Comment_Classification.ipynb"
    click XGB "https://github.com/aashish2502/comment_classifier/blob/main/Comment_Classification.ipynb"
    click LR "https://github.com/aashish2502/comment_classifier/blob/main/Comment_Classification.ipynb"
    click Eval "https://github.com/aashish2502/comment_classifier/blob/main/Comment_Classification.ipynb"
    click Persist "https://github.com/aashish2502/comment_classifier/blob/main/Comment_Classification.ipynb"

    %% Flow
    Dataset --> DataIngest
    Notebook --> DataIngest
    DataIngest --> Preprocess
    Preprocess --> Feature
    Feature --> NB
    Feature --> SVC
    Feature --> XGB
    Feature --> LR
    NB --> Eval
    SVC --> Eval
    XGB --> Eval
    LR --> Eval
    Eval --> Persist

    %% Styles
    classDef orchestrator fill:#E8EAF6,stroke:#1A237E,stroke-width:2px;
    classDef dataStage fill:#D0E6F6,stroke:#1565C0,stroke-width:2px;
    classDef modelStage fill:#D4ECDD,stroke:#2E7D32,stroke-width:2px;
    classDef persistStage fill:#FCE4C4,stroke:#EF6C00,stroke-width:2px;
    classDef external fill:#F6D0D0,stroke:#C62828,stroke-width:2px;
```
