This directory contains step-by-step tutorials for learning and using GeneralizedNotationNotation (GNN), from basic concepts to advanced applications.
File: 01_first_gnn_model.md
Duration: 15 minutes
Goals: Create and validate a basic GNN model
Prerequisites: None
What you'll learn:
- GNN file structure and sections
- Basic variable definitions
- Simple connections
- Running the pipeline
Tutorial Content:
# Your First GNN Model
## Step 1: Create Basic Model
Create file `my_first_model.md`:
```markdown
# My First GNN Model
## GNNVersionAndFlags
GNN v1.0
ProcessingFlags: default
## ModelName
BasicPerceptionModel
## ModelAnnotation
A simple model with one hidden state and one observation.
## StateSpaceBlock
s_f0[2,1,type=categorical] ### Hidden state with 2 categories
o_m0[2,1,type=categorical] ### Observation with 2 categories
## Connections
s_f0 > o_m0 ### Hidden state influences observation
## InitialParameterization
A_m0 = [[0.8, 0.2], [0.3, 0.7]] ### Likelihood matrix
D_f0 = [0.5, 0.5] ### Uniform prior over states
## Time
StaticPut my_first_model.md in a folder (for example path/to/my_models/) and pass that folder to --target-dir.
python src/main.py --target-dir path/to/my_models --only-steps 1,4python src/main.py --target-dir path/to/my_models --only-steps 8Check output/8_visualization_output/ for generated diagrams.
python src/main.py --target-dir path/to/my_models --only-steps 7Your model is now exported to JSON, XML, and other formats!
#### 2. Understanding GNN Syntax
**File**: `02_gnn_syntax_guide.md`
**Duration**: 20 minutes
**Goals**: Master GNN syntax rules and conventions
#### 3. Variable Types and Dimensions
**File**: `03_variables_and_dimensions.md`
**Duration**: 25 minutes
**Goals**: Learn about different variable types and sizing
### 🚀 Intermediate Tutorials
#### 4. Dynamic Models with Actions
**File**: `04_dynamic_models.md`
**Duration**: 30 minutes
**Goals**: Create time-dependent models with control
#### 5. Multi-Modal Observations
**File**: `05_multimodal_observations.md`
**Duration**: 35 minutes
**Goals**: Handle multiple observation modalities
#### 6. Hierarchical Models
**File**: `06_hierarchical_models.md`
**Duration**: 40 minutes
**Goals**: Build complex nested model structures
### 🎓 Advanced Tutorials
#### 7. Custom Simulation Backends
**File**: `07_custom_backends.md`
**Duration**: 45 minutes
**Goals**: Extend GNN to new simulation environments
#### 8. LLM-Enhanced Analysis
**File**: `08_llm_analysis.md`
**Duration**: 30 minutes
**Goals**: Use AI to analyze and improve models
#### 9. Categorical Diagrams with DisCoPy
**File**: `09_categorical_diagrams.md`
**Duration**: 50 minutes
**Goals**: Translate models to category theory
#### 10. JAX Performance Optimization
**File**: `10_jax_optimization.md`
**Duration**: 45 minutes
**Goals**: High-performance model evaluation
## Specialized Tutorials
### 📊 Domain-Specific Applications
#### Active Inference for Robotics
**File**: `robotics/active_inference_robotics.md`
**Goals**: Apply GNN to robotic control and perception
#### Cognitive Modeling
**File**: `cognitive/cognitive_modeling.md`
**Goals**: Model human cognition and decision-making
#### Multi-Agent Systems
**File**: `multiagent/multiagent_systems.md`
**Goals**: Coordinate multiple Active Inference agents
### 🔧 Developer Tutorials
#### Contributing to GNN
**File**: `development/contributing_tutorial.md`
**Goals**: Learn the development workflow
#### Writing Pipeline Extensions
**File**: `development/pipeline_extensions.md`
**Goals**: Add new pipeline steps
#### Custom Visualization Types
**File**: `development/custom_visualizations.md`
**Goals**: Create domain-specific visualizations
## Quick Start Cheat Sheets
### GNN Syntax Quick Reference
```markdown
# Essential GNN Elements
## Variables
s_f0[dims,type] # Hidden state factor 0
o_m0[dims,type] # Observation modality 0
u_c0[dims,type] # Control factor 0
π_c0[dims,type] # Policy factor 0
## Connections
s_f0 > o_m0 # Directed edge (causality)
s_f0 - s_f1 # Undirected edge (correlation)
## Matrices
A_m0[obs,state] # Likelihood matrix
B_f0[state,state,action] # Transition matrix
C_m0[obs] # Preference vector
D_f0[state] # Prior vector
## Types
type=categorical # Discrete categories
type=continuous # Real-valued
type=binary # Boolean
# Basic commands
python src/main.py --target-dir examples/
python src/main.py --only-steps 1,4,6
python src/main.py --skip 11,12,13
# Advanced options
python src/main.py --parallel --conservative
python src/main.py --debug --verbose
python src/main.py --output-dir custom_output/notebooks/interactive_gnn_tutorial.ipynbnotebooks/active_inference_primer.ipynbnotebooks/model_comparison_workshop.ipynb
- Web-based GNN editor (coming soon)
- Real-time syntax validation
- Instant visualization
Located in tutorials/assets/:
basic_examples/- Simple models for learningintermediate_examples/- More complex scenariosadvanced_examples/- Cutting-edge applicationsbroken_examples/- Common mistakes to avoid
data/simple_observations.csvdata/robotics_sensors.jsondata/cognitive_experiment_results.pkl
solutions/- Complete solutions for tutorial exercisessolutions/explained/- Step-by-step explanations
- Check tutorial README files
- Look for
HINTS.mdin tutorial directories - Compare your work with provided solutions
- Join tutorial discussion forums
- Participate in weekly GNN workshops
- Share your models with the community
- See
../troubleshooting/README.mdfor common issues - Use
--debugflag for detailed error messages - Check tutorial-specific troubleshooting sections
- Web-based interactive tutorials
- Video walkthroughs
- Advanced mathematical foundations
- Industry-specific applications
- Integration with popular ML frameworks
We welcome tutorial contributions! See ../development/writing_tutorials.md for guidelines.
- Each tutorial includes exercises and solutions
- Self-assessment quizzes
- Practical project assignments
- Beginner: Can create and validate basic models
- Intermediate: Handles dynamic and multi-modal models
- Advanced: Develops custom extensions and optimizations
- Expert: Contributes to GNN development and research
Start with 01_first_gnn_model.md and work your way up!