Companion Code Library for Learning as Geometry Discovery
Author: Agus Sudjianto | Date: March 2026
Learning is geometry discovery under task constraints.
A model does not merely map inputs to outputs. It discovers or imposes a geometry — a system of distances, directions, comparisons, and admissible transformations — in which the relevant structure becomes visible and actionable. The fitted function is the visible outcome; the geometry that makes it stable, useful, and intelligible is the deeper achievement.
Learning as Geometry Discovery is a geometry-first interpretation of machine learning and data science. It offers a unifying framework that connects classical statistical models, modern deep learning, memory systems, and reasoning architectures through a shared geometric vocabulary.
- Representation is a hypothesis. Every choice of features, coordinates, or embedding is a hypothesis about what structure matters.
- Metric geometry is not enough. Distance, similarity, and inner products capture enormous structure — but direction, order, flow, and constrained composition require richer tools.
- Local simplicity is the source of interpretability. Models become interpretable not by being globally simple, but by being locally simple in a discoverable way.
- Reasoning requires constrained movement through state. Memory, knowledge retrieval, and logical inference are forms of directed, constrained movement through a structured state space.
The book has nineteen chapters in eight parts:
| Part | Title | Chapters |
|---|---|---|
| I | Why Geometry Is the Real Object of Learning | 1 -- 2 |
| II | Expanding the Geometric Vocabulary | 3 -- 6 |
| III | Geometric Algebra in Learning | 7 -- 10 |
| IV | Attention, Interaction, and Learned Geometry | 11 -- 12 |
| V | Models as Geometric Mechanisms | 13 -- 14 |
| VI | Time, Causality, and Directional Systems | 15 -- 16 |
| VII | Reasoning, Memory, and Knowledge | 17 -- 18 |
| VIII | Synthesis and Research Agenda | 19 |
Parts I--II build the geometric ladder: coordinates, inner products, similarity, kernels, partition geometry, manifolds, and curvature — covering most of classical machine learning. Part III introduces directional structure: geometric algebra, rotation, and the symmetric/antisymmetric operator decomposition. Part IV develops learned geometry: attention and interaction. Part V reinterprets familiar models as geometric mechanisms. Part VI extends geometry to time, causality, transport, and flow. Part VII treats knowledge, memory, and reasoning as geometrically structured state evolution. Part VIII synthesizes the framework and proposes a research agenda.
- Practical ML and statistics: Chapters 1--6, 9--14, 19
- Representation and deep learning: Chapters 1--4, 7--12, 16, 18--19
- Memory, reasoning, and agentic systems: Chapters 7--12, 15--19
- ML and data science practitioners who want deeper structural understanding of why models work
- Statisticians seeking a broader geometric language beyond classical covariance-and-projection
- Advanced undergraduates and graduate students looking for a unifying conceptual framework
- Researchers in interpretability, reasoning, memory, and trustworthy AI
The main text is accessible with linear algebra and basic probability. Graduate extensions deepen the mathematics. Computational labs make the ideas concrete.
geomlearn is the companion PyTorch library implementing the geometric algorithms, decompositions, and diagnostics from each chapter of the book.
pip install geomlearnOr install from source:
git clone https://github.com/asudjianto-xml/geomlearn.git
cd geomlearn
pip install .- Python >= 3.10
- PyTorch >= 2.0
Each module provides a consistent interface:
analyze()— extract geometric quantities from data or modelsdiagnose()— run health checks, return structured diagnostics- Classes use
fit()/transform()pattern where applicable - All tensors are PyTorch tensors; GPU-aware via
deviceparameter
| Module | Topic |
|---|---|
ch01_geometry_discovery |
Learning as geometry discovery |
ch02_everyday_geometry |
Geometry in everyday data science |
ch03_basic_geometry |
Basic language of geometry |
ch04_kernels |
Kernels, similarity, and comparison |
ch05_partitions |
Partition geometry |
ch06_manifolds |
Manifolds and nonlinear geometry |
ch07_direction_flow |
Direction, asymmetry, and flow |
ch08_geometric_algebra |
Orientation, antisymmetry, geometric algebra |
ch09_rotations |
Rotation, direction, small structured change |
ch10_operator_decomposition |
Symmetric and antisymmetric structure |
ch11_attention |
Attention as learned geometry |
ch12_interaction |
Interaction geometry |
ch13_classical_models |
Classical models revisited as geometry |
ch14_tree_stretch |
Tree-routed stretch models |
ch15_time_series |
Time series, causality, directional geometry |
ch16_transport |
Transport, propagation, and flow |
ch17_knowledge_memory |
Knowledge and memory as geometric state |
ch18_reasoning |
Reasoning as constrained movement |
ch19_synthesis |
Synthesis and open problems |
import torch
import geomlearn
# Example: analyze geometric structure of a dataset
X = torch.randn(100, 5)
result = geomlearn.ch03_basic_geometry.analyze(X)The companion_book/ directory contains Jupyter notebooks (one per chapter) with worked examples and computational labs that demonstrate the library in action. These notebooks correspond to the computational labs described in the book.
MIT