Buckets:
835 MB
10,492 files
Updated 4 months ago
Ctrl+K
| Name | Size | Uploaded | Xet hash |
|---|---|---|---|
| 01_Advanced_KG_Embeddings.ipynb | 97.1 kB xet | 66081b89 | |
| 02_Graph_Neural_Networks.ipynb | 106 kB xet | 939c095d | |
| CA10.ipynb | 221 kB xet | 6e25b2d4 | |
| CA10_enhanced.ipynb | 256 kB xet | afb7380e | |
| README.md | 5.97 kB xet | a1e94bd0 | |
| add_complete_fa_markdowns.py | 24.7 kB xet | d528e681 | |
| add_fa_markdowns.py | 26.9 kB xet | 6a8f0998 | |
| add_remaining_sections.py | 15.5 kB xet | 320e3fba | |
| enhance_notebook.py | 21 kB xet | 0e079e5a |
CA10 Knowledge Graphs - Notebooks
📚 Available Notebooks
1. 01_Advanced_KG_Embeddings.ipynb
Advanced knowledge graph embedding techniques:
- SimplE, RotatE, ConvE
- Graph Attention Networks
- Transformer-based embeddings
2. 02_Graph_Neural_Networks.ipynb ✨ NEW & COMPLETE
Comprehensive GNN tutorial for Knowledge Graphs:
- GCN: Graph Convolutional Networks
- GAT: Graph Attention Networks
- GraphSAGE: Sample and Aggregate
- R-GCN: Relational GCN for multi-relational graphs
Features:
- ✅ 25+ cells with code and markdown
- ✅ Complete implementations of 4 GNN architectures
- ✅ Training pipeline for link prediction
- ✅ Attention weight visualization
- ✅ t-SNE embedding visualization
- ✅ Model comparison and benchmarking
- ✅ Comprehensive mathematical formulas
- ✅ Production-ready code
3. CA10.ipynb
Main project notebook with all CA10 implementations
📖 Documentation
Main Documents:
GNN_NOTEBOOK_GUIDE.md: Complete 300+ line guide covering:- Detailed theory for each GNN architecture
- Mathematical formulas and intuitions
- Implementation details
- Usage instructions
- Troubleshooting
- Research applications
- References
NOTEBOOK_COMPLETION_REPORT.md: Technical report with:- Implementation statistics
- Feature checklist
- Code metrics
- Testing status
🚀 Quick Start
Running 02_Graph_Neural_Networks.ipynb:
# 1. Install dependencies
pip install torch torch-geometric scikit-learn matplotlib seaborn
# 2. Launch Jupyter
cd /path/to/CA10_knowledge_graphs/notebooks
jupyter notebook 02_Graph_Neural_Networks.ipynb
# 3. Run all cells or execute step by step
Prerequisites:
# Core dependencies
torch>=2.0.0
torch-geometric>=2.4.0
scikit-learn>=1.3.0
matplotlib>=3.7.0
seaborn>=0.12.0
numpy>=1.24.0
📊 Notebook Structure
02_Graph_Neural_Networks.ipynb Sections:
- Introduction - Overview and objectives
- Setup - Imports and configuration
- Knowledge Graph - Create and visualize KG
- GCN - Theory + Implementation
- GAT - Attention mechanism + Visualization
- GraphSAGE - Sampling and aggregation
- R-GCN - Multi-relational reasoning
- Training - Link prediction pipeline
- Comparison - Model benchmarking
- Visualization - t-SNE embeddings
- Summary - Key takeaways
🎯 Learning Objectives
After completing these notebooks, you will understand:
- ✅ Graph Neural Network fundamentals
- ✅ Message passing framework
- ✅ Attention mechanisms in graphs
- ✅ Aggregation strategies
- ✅ Multi-relational graph reasoning
- ✅ Knowledge graph embedding techniques
- ✅ Link prediction tasks
- ✅ Model comparison and selection
🔬 What's Implemented
GNN Architectures:
| Model | Layers | Parameters | Best For |
|---|---|---|---|
| GCN | 2 | ~50K | Simple graphs |
| GAT | 2 (4 heads) | ~75K | Varying importance |
| GraphSAGE | 2 | ~55K | Large-scale |
| R-GCN | 2 | ~60K | Multi-relational |
Features:
- Forward propagation
- Training loops
- Loss computation
- Accuracy metrics
- Visualization tools
- Model comparison
📈 Visualizations Included
- Knowledge Graph Structure: NetworkX visualizations
- Attention Weights: Histogram + bar charts
- Training Curves: Loss over epochs
- Embeddings: t-SNE 2D projections (2x2 grid)
- Model Comparison: Parameter and performance tables
🎓 Educational Value
Target Audience:
- Students learning GNNs
- Researchers working with Knowledge Graphs
- Engineers building graph-based systems
- Anyone interested in graph neural networks
Difficulty Level:
- Prerequisite: Basic Python, PyTorch, Graph theory
- Level: Intermediate to Advanced
- Time: 2-3 hours to complete
💡 Key Concepts Covered
Theory:
- Graph convolutions
- Message passing
- Attention mechanisms
- Aggregation functions
- Basis decomposition
- Over-smoothing
- Inductive learning
Practice:
- PyTorch implementation
- PyTorch Geometric usage
- Training on Knowledge Graphs
- Link prediction
- Embedding visualization
- Model selection
🔧 Customization
You can easily modify:
- Embedding dimensions
- Number of layers
- Hidden dimensions
- Dropout rates
- Learning rates
- Aggregation functions
- Number of attention heads
- Number of bases (R-GCN)
📚 References
Papers:
- Kipf & Welling - "Semi-Supervised Classification with GCNs" (ICLR 2017)
- Veličković et al. - "Graph Attention Networks" (ICLR 2018)
- Hamilton et al. - "Inductive Representation Learning" (NIPS 2017)
- Schlichtkrull et al. - "Modeling Relational Data" (ESWC 2018)
Resources:
- PyTorch Geometric: https://pytorch-geometric.readthedocs.io/
- Stanford CS224W: http://web.stanford.edu/class/cs224w/
- Distill.pub: https://distill.pub/
🐛 Troubleshooting
Common Issues:
ImportError: torch_geometric not found
pip install torch-geometric torch-scatter torch-sparse
CUDA out of memory
- Reduce batch size or embedding dimension
- Use CPU:
device = 'cpu'
Slow training
- Use GPU if available
- Reduce number of layers
- Use GraphSAGE with sampling
See GNN_NOTEBOOK_GUIDE.md for more troubleshooting tips.
🎉 Status
- ✅ Complete: All notebooks functional
- ✅ Documented: Comprehensive guides
- ✅ Tested: Code verified
- ✅ Production-Ready: Professional quality
📞 Support
For questions:
- Review
GNN_NOTEBOOK_GUIDE.md - Check main CA10 README
- Consult PyTorch Geometric docs
Happy Learning! 🚀📚
Part of the System2_in_AI CA10 project
Last updated: October 10, 2025
- Total size
- 835 MB
- Files
- 10,492
- Last updated
- Jun 17
- Pre-warmed CDN
- US EU US EU