Dual-view graph label propagation for low-resource fake-news detection
# Dual-Graph Label Propagation for Fake-News Detection
This repository contains a reproducible, dependency-light implementation of a
low-resource fake-news detector. It builds two graphs over labeled and unlabeled news:
1. a **semantic graph** derived from TF-IDF features with optional SVD reduction; and
2. an optional **affective graph** derived from serialized emotion/style vectors.
Labels are propagated independently through both graphs and their class probabilities
are fused. The method is transductive: test documents help define the graph geometry,
while test labels are never provided to the model.
## Why this release exists
The original research prototype demonstrated the core idea but depended on local model
paths, server-specific dataset paths, and an import-time batch experiment. This curated
release turns that prototype into a small command-line package with validation, tests,
and synthetic data that can run on CPU without downloading a language model.
## Installation
```bash
python -m venv .venv
source .venv/bin/activate # Windows: .venv\Scripts\activate
python -m pip install -e .
```
Python 3.10+ and NumPy are required. Install the test dependency with:
```bash
python -m pip install -e ".[dev]"
```
## Quick start
```bash
dglp-fnd \
--train examples/train.csv \
--test examples/test.csv \
--output outputs/predictions.csv \
--text-weight 0.7
```
Or run the module directly:
```bash
python -m dglp_fnd --train examples/train.csv --test examples/test.csv
```
The command writes one prediction and one probability column per class. If the test
file contains a `label` column, it also prints evaluation accuracy.
## Input format
Training CSV files must contain:
| Column | Required | Description |
| --- | --- | --- |
| `content` | yes | News text used to construct the semantic graph. |
| `label` | training only | Class label, for example `real` or `fake`. |
| `affection` | no | A scalar, list, or nested list serialized as text. |
Column names can be …