How ansh2508/han-fake-news-detector works
This repository trains and evaluates a hierarchical attention network for fake-news classification. The main workflow is preparing labeled text as hierarchical token sequences, training the HAN, and evaluating classification performance; a separate notebook evaluates the saved model on another dataset. The source shows the preprocessing, model, and trainer implementations, while README statements describe notebook-level workflows and outputs. Notebook internals were not sampled, so their links to implementation stages are documented only where supported.
Main entry points: pipeline.ipynb Training pipeline · model_trainer.py Model trainer · external_dataset_test.ipynb External evaluation · data_preprocessor.py Text preprocessing
Components 13
Data preparation
- Fake articles
data/Fake.csv - True articles
data/True.csv - Text preprocessing
src/data_preprocessor.py - Hierarchical dataset
src/data_preprocessor.py - Saved vocabulary
vocabulary.pkl
HAN modeling
- Model trainer
src/model_trainer.py - HAN classifier
src/han_model.py
Evaluation and results
- Training pipeline
pipeline.ipynb - Model checkpoint
- External evaluation
external_dataset_test.ipynb - Model card
- Evaluation plots
plots
Other components
- Researcher
Connections 16
- Researcher → Training pipeline: runs
README.md - Fake articles → Training pipeline: training input
- True articles → Training pipeline: training input
- Training pipeline → Text preprocessing: uses preprocessing
- Text preprocessing → Hierarchical dataset: encodes text
src/data_preprocessor.py - Training pipeline → Model trainer: trains model
- Model trainer → HAN classifier: constructs and trains
src/model_trainer.py - Model trainer → Text preprocessing: uses prediction utilities
src/model_trainer.py - Model trainer → Model checkpoint: saves and loads
src/model_trainer.py - Training pipeline → Model checkpoint: produces
README.md - Training pipeline → Evaluation plots: generates
README.md - Researcher → External evaluation: runs
README.md - External evaluation → Model checkpoint: loads
README.md - External evaluation → Saved vocabulary: loads
README.md - External evaluation → Text preprocessing: evaluates text
- Training pipeline → Model card: records results