Prototype implementation of an explainable educational recommender using knowledge graph reasoning and GNN concepts (accompanying published patent).
This repository provides a prototype implementation accompanying a published patent on explainable educational recommendation using knowledge graphs and graph reasoning.
This project demonstrates a Graph Neural Network (GNN) approach to explainable education recommendations. It uses a heterogeneous knowledge graph to model relationships between Learners, Resources, and Concepts, enabling multi-hop reasoning (e.g., "You failed Topic X because you missed Prerequisite Y").
- Clone the repository
- Install dependencies:
pip install -r requirements.txt
- Run the Jupyter Notebook:
(Or open directly in VS Code / Google Colab)
jupyter notebook gnn_reasoning_demo.ipynb
Dataset Note: The dataset is synthetic and intentionally small to demonstrate reasoning behavior rather than model performance.
The dataset follows a normalized heterogeneous knowledge graph schema separating node entities and edge relations. Concepts form a prerequisite dependency graph, resources are mapped to concepts, and learner interactions provide learning signals. The structure enables reasoning over missing prerequisites and generation of interpretable recommendation paths.
Defines the core knowledge units.
concept_id: Unique ID (e.g.,c1)name: Concept name (e.g., "Python Basics")
Defines the dependency graph between concepts.
- Edge Meaning:
concept_id -> prerequisite_idmeans Concept ID depends on Prerequisite ID (Target -> Source). - Example:
c2, c1means "Control Flow" requires "Python Basics".
Educational materials mapped to concepts.
- Edge Meaning:
resource_id -> concept_idmeans Resource teaches Concept. resource_id: Unique ID (e.g.,r1)title: Title of the resourceconcept_id: The concept covered
Users and their specific learning objectives.
learner_id: Unique ID (e.g.,l1)name: Learner nametarget_concept_id: The goal concept the learner wants to master.- Edge Meaning:
learner_id -> target_concept_idmeans Learner targets Concept.
Logs of learner activities with outcomes.
- Edge Meaning:
learner_id -> resource_idmeans Learner interacted with Resource. status: Interaction outcome (completed,attempted,failed).timestamp: ISO 8601 format (YYYY-MM-DD).
The graph structure supports explainable reasoning:
- Good Learner (Asha): Follows the path
c1 -> c2 -> c3 -> c4. Success is predicted because prerequisitesc1, c2, c3are satisfied. - Failing Learner (Ravi): Targets
c4but has only attemptedc4directly (skipping prerequisites). The system can explain: "Failedr5(OOP) because prerequisitesc3(Functions) andc2(Control Flow) are missing."
The following example demonstrates the explainability pathway generated by the system on the synthetic dataset.
Learner: Asha Target Goal: Data Structures (c5)
Learning history:
- Completed Python Basics (c1)
- Completed Control Flow (c2)
- Failed Object Oriented Programming (c4)
Target Concept: Data Structures (c5)
Required Path:
c5 -> c4 -> c3 -> c2 -> c1
Learner Known Concepts:
c1, c2
Missing Prerequisite:
c3 (Functions)
Failure Explanation: The learner attempted Object Oriented Programming before mastering Functions.
"Functions Explained" (r3)
Explanation:
You attempted to learn Object Oriented Programming, but it requires understanding Functions. We recommend completing "Functions Explained" before proceeding toward your goal: Data Structures.
This repository demonstrates reasoning and explainability logic primarily. It does not include large-scale training or performance evaluation. The focus is on the graph construction and path-based reasoning algorithms described in the patent.