A research-grade implementation for detecting and analyzing fake news propagation patterns on social media using the FakeNewsNet dataset.
- Find Key Spreaders – Identify influential users using attention weights
- Map Full Spread – Build propagation trees for each news item
- Build Simple, Strong Model – Efficient GAT without heavy architecture
- Get Better Results – Combine user influence, post content, and source credibility
- Explain Decisions – Interpret attention weights and propagation paths
FakeNewsNet: https://github.com/KaiDMML/FakeNewsNet
Components:
- News content (source, headline, body text, images/videos)
- Social context (user profiles, content, followers, followees)
- User-user and user-post interaction graphs
majorProject/
├── data/ # Raw and processed data
│ ├── raw/ # FakeNewsNet raw JSON files
│ ├── processed/ # Cleaned and preprocessed data
│ └── graphs/ # Constructed graph structures
├── src/ # Source code
│ ├── data/ # Data ingestion and preprocessing
│ ├── features/ # Feature engineering
│ ├── models/ # GAT model definitions
│ ├── training/ # Training scripts
│ ├── evaluation/ # Evaluation and metrics
│ └── visualization/ # Attention maps and graphs
├── notebooks/ # Jupyter notebooks for exploration
├── configs/ # Configuration files
├── experiments/ # Training logs and checkpoints
├── outputs/ # Results, predictions, reports
└── tests/ # Unit tests
- Python 3.10+
- uv package manager
- Install uv (if not already installed):
curl -LsSf https://astral.sh/uv/install.sh | sh- Create virtual environment and install dependencies:
# Initialize project with uv
uv venv
# Activate virtual environment
source .venv/bin/activate # On macOS/Linux
# Install dependencies
uv pip install -e .- Download FakeNewsNet dataset:
python scripts/download_dataset.pypython src/data/preprocess.py --input data/raw --output data/processedpython src/features/build_graph.py --config configs/graph_config.yamlpython src/training/train_gat.py --config configs/model_config.yamlpython src/evaluation/evaluate.py --checkpoint experiments/best_model.pt
python src/visualization/generate_reports.py- Accuracy
- F1-Score
- AUC-ROC
- Explanation Fidelity
- Propagation graphs
- Attention-based influence maps
- Confusion matrices
- Performance summaries
from src.models.gat_model import FakeNewsGAT
from src.training.trainer import GATTrainer
model = FakeNewsGAT(
in_channels=768,
hidden_channels=128,
num_classes=2,
num_layers=3
)
trainer = GATTrainer(model, train_loader, val_loader)
trainer.train(epochs=100)from src.evaluation.explainability import AttentionAnalyzer
analyzer = AttentionAnalyzer(model, graph_data)
key_spreaders = analyzer.identify_influential_users(top_k=20)
analyzer.visualize_propagation_tree(news_id='article_123')- PyTorch Geometric: Graph neural networks
- Transformers (HuggingFace): BERT embeddings
- NetworkX: Graph construction and analysis
- scikit-learn: Classical ML metrics and preprocessing
- matplotlib/seaborn: Visualization
All predictions are accompanied by:
- Attention weight distributions
- Top influential users in propagation chains
- Propagation path visualizations
- Feature importance analysis
- Purpose: Research and analysis only
- Focus: Code efficiency and model accuracy
- Interpretability: Attention weights logged and visualized for all predictions
MIT License - For research purposes only
This is a research project. For questions or collaboration, please open an issue.
[Your contact information]