Self-contained Jupyter notebooks for knowledge graph–based recommender systems on MovieLens 1M, with temporal learning and fairness/exposure bias mitigation.
This project studies knowledge graph–based recommender systems on the MovieLens 1M dataset, focusing on how popularity bias evolves over time and how fairness can be enforced across user and item groups. The dataset was extracted from a specific time range (May–December 2000) and split into eight monthly temporal slices, simulating the real-world evolution of user preferences and item popularity.
Movies are grouped into popularity tiers—Low, Medium, High—based on interaction counts in each slice. Users are classified as mainstream or niche depending on their engagement with high-popularity movies. This design allows the project to measure how recommendation systems favor popular items over time and to evaluate interventions that mitigate this bias.
The project examines three stages of modeling:
- Baseline models – standard graph-based recommenders (DistMult, TransH, LightGCN, KGCN, PinSAGE) without temporal or fairness adjustments.
- Temporal models – introducing temporal regularization to stabilize embeddings across slices and reduce abrupt shifts in recommendations.
- Final models – incorporating fairness regularization and exposure mitigation, ensuring that niche movies and underrepresented user groups receive fairer visibility.
📊 Metrics tracked include Recall@K, NDCG@K, Exposure Fairness (EO), Demographic Parity (DP), and Gini Index, allowing analysis of both recommendation quality and fairness.
By combining temporal slicing, popularity tiers, and fairness-aware modeling, this project provides a systematic exploration of how popularity bias dominates over time and how it can be mitigated, offering insights for designing fairer and more robust recommender systems.
| 📓 Notebook | 🔍 Purpose |
|---|---|
data-preprocessing.ipynb |
General preprocessing reference (not needed for running models) |
baseline-*.ipynb |
Baseline models with built-in preprocessing |
temporal-*.ipynb |
Temporal models (time-aware versions) |
final-*.ipynb, pinsage-final.ipynb |
Final models with fairness & exposure mitigation |
hyperparam-test-for-kgcn.ipynb |
KGCN hyperparameter tuning experiments |
⚠️ Every notebook already includes preprocessing for that specific model, so you don’t need to rundata-preprocessing.ipynb.
- Clone the repo:
git clone https://github.com/Sajith-Santhosh/TemporalFairRecSysFramework.git- Open any notebook in Jupyter, Colab, or Kaggle.
- Run all cells top-to-bottom.
- Metrics are printed directly in outputs (no plots saved).
| Model | 🔹 Description |
|---|---|
| DistMult | Knowledge graph embedding |
| TransH | Knowledge graph embedding with relation hyperplanes |
| KGCN | Knowledge graph convolutional network |
| LightGCN | Simplified GCN for collaborative filtering |
| PinSage | Graph-based recommendations with random walks |
| Temporal / Fair | Variants with temporal smoothing & fairness regularization |
| Metric | Meaning |
|---|---|
| ✅ Recall | How many relevant items got recommended |
| 🎯 NDCG | Ranking quality |
| ⚖️ EO (Equal Opportunity) | Fairness across user slices |
| 🏛️ DP (Demographic Parity) | Exposure fairness across groups |
| 🌈 Gini | Concentration / diversity of item exposure |
All metrics are printed inline in the notebook outputs.
| Model | Paper |
|---|---|
| DistMult | Yang et al., "Embedding Entities and Relations for Learning and Inference in Knowledge Bases" (2015) |
| TransH | Wang et al., "Knowledge Graph Embedding by Translating on Hyperplanes" (2014) |
| KGCN | Wang et al., "KGAT: Knowledge Graph Attention Network for Recommendation" (2019) |
| LightGCN | He et al., "LightGCN: Simplifying and Powering Graph Convolution Network for Recommendation" (2020) |
| PinSage | Ying et al., "Graph Convolutional Neural Networks for Web-Scale Recommender Systems" (2018) |