# lukmanharahap/fake-news-detection architecture

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

- Interactive diagram: https://gitdiagram.com/lukmanharahap/fake-news-detection
- Repository: https://github.com/lukmanharahap/fake-news-detection

## Overview

HoaXGY is an Indonesian fake-news classification ML pipeline that trains a classical baseline and a CNN, evaluates the mobile-format model, and exports artifacts for Android handoff. The primary workflow is orchestrated by `main.py`: load the sample dataset, prepare and split text, train/evaluate both models, then save Keras and TFLite outputs. Source-specific cleaning is available when building datasets from multiple sources. The README documents Android consumption; app-side inference is outside this repository. Arrows reflect shown calls or documented behavior; unsampled Android integration is not inferred.

Main entry points: [`main.py`](https://github.com/lukmanharahap/fake-news-detection/blob/main/main.py) (Training orchestrator), [`src/pipeline.py`](https://github.com/lukmanharahap/fake-news-detection/blob/main/src/pipeline.py) (Dataset builder), [`models/HoaXGY_model.tflite`](https://github.com/lukmanharahap/fake-news-detection/blob/main/models/HoaXGY_model.tflite) (TFLite model), [`dataset/sample_dataset.xlsx`](https://github.com/lukmanharahap/fake-news-detection/blob/main/dataset/sample_dataset.xlsx) (Sample dataset)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_preparation["Data preparation"]
  node_dataset["Sample dataset"]
  node_builder["Dataset builder<br/>[pipeline.py]"]
  node_cleaner["Text cleaner<br/>[data_cleaner.py]"]
  node_splitter["Train-validation split<br/>[pipeline.py]"]
end

subgraph group_training["Model training"]
  node_orchestrator["Training orchestrator<br/>[main.py]"]
  node_baseline["TF-IDF baseline<br/>[models.py]"]
  node_deepmodel["CNN classifier<br/>[models.py]"]
end

subgraph group_handoff["Model handoff"]
  node_baselineartifact["Baseline artifact<br/>[baseline.pkl]"]
  node_kerasartifact["Keras model<br/>[HoaXGY_model.keras]"]
  node_tfliteartifact["TFLite model"]
end

node_engineer(("ML engineer"))
node_android(("Android app"))

node_engineer -->|"runs"| node_orchestrator
node_orchestrator -->|"loads"| node_dataset
node_orchestrator -->|"creates and calls"| node_builder
node_builder -->|"applies cleanup"| node_cleaner
node_orchestrator -->|"splits data"| node_splitter
node_orchestrator -->|"trains and evaluates"| node_baseline
node_orchestrator -->|"saves"| node_baselineartifact
node_orchestrator -->|"trains and evaluates"| node_deepmodel
node_orchestrator -->|"saves"| node_kerasartifact
node_orchestrator -->|"exports and evaluates"| node_tfliteartifact
node_android -.->|"consumes"| node_tfliteartifact

click node_orchestrator "https://github.com/lukmanharahap/fake-news-detection/blob/main/main.py"
click node_dataset "https://github.com/lukmanharahap/fake-news-detection/blob/main/dataset/sample_dataset.xlsx"
click node_builder "https://github.com/lukmanharahap/fake-news-detection/blob/main/src/pipeline.py"
click node_cleaner "https://github.com/lukmanharahap/fake-news-detection/blob/main/src/data_cleaner.py"
click node_splitter "https://github.com/lukmanharahap/fake-news-detection/blob/main/src/pipeline.py"
click node_baseline "https://github.com/lukmanharahap/fake-news-detection/blob/main/src/models.py"
click node_deepmodel "https://github.com/lukmanharahap/fake-news-detection/blob/main/src/models.py"
click node_baselineartifact "https://github.com/lukmanharahap/fake-news-detection/blob/main/models/baseline.pkl"
click node_kerasartifact "https://github.com/lukmanharahap/fake-news-detection/blob/main/models/HoaXGY_model.keras"
click node_tfliteartifact "https://github.com/lukmanharahap/fake-news-detection/blob/main/models/HoaXGY_model.tflite"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_dataset,node_builder,node_cleaner,node_splitter toneBlue
class node_orchestrator,node_baseline,node_deepmodel toneAmber
class node_baselineartifact,node_kerasartifact,node_tfliteartifact toneMint
class node_engineer,node_android toneIndigo
```

## Components

### Data preparation

- [Sample dataset](https://github.com/lukmanharahap/fake-news-detection/blob/main/dataset/sample_dataset.xlsx): `dataset/sample_dataset.xlsx`
- [Dataset builder](https://github.com/lukmanharahap/fake-news-detection/blob/main/src/pipeline.py): `src/pipeline.py`
- [Text cleaner](https://github.com/lukmanharahap/fake-news-detection/blob/main/src/data_cleaner.py): `src/data_cleaner.py`
- [Train-validation split](https://github.com/lukmanharahap/fake-news-detection/blob/main/src/pipeline.py): `src/pipeline.py`

### Model training

- [Training orchestrator](https://github.com/lukmanharahap/fake-news-detection/blob/main/main.py): `main.py`
- [TF-IDF baseline](https://github.com/lukmanharahap/fake-news-detection/blob/main/src/models.py): `src/models.py`
- [CNN classifier](https://github.com/lukmanharahap/fake-news-detection/blob/main/src/models.py): `src/models.py`

### Model handoff

- [Baseline artifact](https://github.com/lukmanharahap/fake-news-detection/blob/main/models/baseline.pkl): `models/baseline.pkl`
- [Keras model](https://github.com/lukmanharahap/fake-news-detection/blob/main/models/HoaXGY_model.keras): `models/HoaXGY_model.keras`
- [TFLite model](https://github.com/lukmanharahap/fake-news-detection/blob/main/models/HoaXGY_model.tflite): `models/HoaXGY_model.tflite`

### Other components

- **ML engineer**
- **Android app**

## Connections

- ML engineer → Training orchestrator: runs (evidence: `README.md`)
- Training orchestrator → Sample dataset: loads (evidence: `main.py`)
- Training orchestrator → Dataset builder: creates and calls (evidence: `main.py`)
- Dataset builder → Text cleaner: applies cleanup (evidence: `src/pipeline.py`)
- Training orchestrator → Train-validation split: splits data (evidence: `main.py`)
- Training orchestrator → TF-IDF baseline: trains and evaluates (evidence: `main.py`)
- Training orchestrator → Baseline artifact: saves (evidence: `main.py`)
- Training orchestrator → CNN classifier: trains and evaluates (evidence: `main.py`)
- Training orchestrator → Keras model: saves (evidence: `main.py`)
- Training orchestrator → TFLite model: exports and evaluates (evidence: `main.py`)
- Android app → TFLite model: consumes (evidence: `README.md`)
