A sophisticated implementation of Input Convex Graph Neural Networks with novel applications to temporal graph dynamics and heat diffusion modeling.
This project implements Input Convex Graph Recurrent Neural Networks, combining three cutting-edge machine learning paradigms:
- Input Convex Neural Networks (mathematical convexity constraints)
- Graph Neural Networks (spatial relationship modeling)
- Recurrent Neural Networks (temporal dynamics)
The architecture maintains mathematical convexity throughout the network while modeling complex graph dynamics over time, enabling guaranteed optimization properties and interpretable predictions.
1. Convex Layer Implementation
class ConvexLayer(nn.Module):
def forward(self, x):
# Ensure convexity with non-negative weights
return F.linear(x, F.relu(self.weight), self.bias)2. Graph Convex Message Passing
- Degree-normalized message aggregation
- Convexity-preserving weight constraints
- Skip connections for gradient flow
3. Recurrent Convex Updates
- Temporal state evolution with convex constraints
- Multi-step prediction capability
- Memory-efficient sequential processing
The network ensures input convexity by constraining all weights to be non-negative:
f(αx₁ + (1-α)x₂) ≤ αf(x₁) + (1-α)f(x₂)
This mathematical property guarantees:
- Global optimization properties
- Interpretable gradients
- Stable training dynamics
Benchmark Performance on Standard Graph Datasets:
| Dataset | ICGCN Accuracy | Benchmark Accuracy | Cross-entropy Loss |
|---|---|---|---|
| Cora | 0.78 | 0.81 | +0.11 (0.68 vs 0.57) |
| PubMed | 0.73 | 0.79 | +0.14 (0.77 vs 0.63) |
Key Findings:
- Competitive accuracy with standard GCN baselines
Breakthrough Results on Temporal Graph Dynamics:
| Objective | MSE Loss | Performance |
|---|---|---|
| Temperature Trajectory | 0.007244 | Excellent prediction accuracy |
| Control Input | 0.000101 | 10x better precision for control strategies |
Technical Achievement:
- Successfully models controlled heat diffusion on graphs over time
- Captures complex spatio-temporal dynamics with convex constraints
- Demonstrates practical applicability to physical systems modeling
The model accurately predicts both temperature evolution and optimal control strategies, with particularly impressive precision for control input prediction (MSE: 0.000101).
- Robust Training Pipeline with gradient clipping and NaN detection
- Multi-dataset Support (Cora, PubMed, synthetic heat diffusion)
- Flexible Architecture supporting both static and temporal graph tasks
- Mathematical Rigor ensuring convexity preservation throughout training
icgrnn/
├── layers/ # Convex layer implementations
├── models/ # Complete model architectures
├── message_passing/ # Graph convolution with convexity
├── experiments/ # Dataset-specific training scripts
└── training/ # Robust training utilities
# Install dependencies
pip install -r requirements.txt
# Run experiments
python icgrnn/experiments/cora.py # Node classification on Cora
python icgrnn/experiments/pubmed.py # Node classification on PubMed
python icgrnn/experiments/heat_diffusion.py # Novel heat diffusion modelingfrom models import ICGRNN
# Initialize model
model = ICGRNN(
input_dim=2,
hidden_dim=64,
output_dim=1,
icnn_hidden_dims=[32, 32]
)
# Train on your graph data
output, hidden = model(x, edge_index, steps=20)- Convexity-Preserving Graph Operations - Novel message passing that maintains input convexity
- Temporal Convex Dynamics - First application of convex constraints to graph RNNs
- Heat Diffusion Control - Original application demonstrating practical utility
- Production-ready error handling and gradient stability
- Modular design supporting research extensions
- Comprehensive experimental validation
Temperature evolution prediction (left) and control input optimization (right)
Potential Use Cases:
- Physics Simulation - Heat transfer, fluid dynamics on networks
- Control Systems - Optimal control of distributed systems
- Optimization - Convex optimization on graph-structured data
- Financial Modeling - Risk propagation in financial networks
Research Significance:
- Bridges convex optimization and graph neural networks
- Enables guaranteed optimization properties in graph learning
- Opens new research directions in constrained neural architectures
- Scalability - Optimization for larger graphs
- Additional Applications - Financial networks, social dynamics
- Theoretical Analysis - Convergence guarantees and optimization bounds
- Hardware Acceleration - GPU optimization for large-scale deployment
Built with mathematical rigor, engineered for impact.
This implementation demonstrates the successful fusion of theoretical constraints with practical machine learning, opening new possibilities for interpretable and optimizable graph neural networks.