This example demonstrates analogy inference in hyperdimensional computing:
"What is the dollar of Mexico?"
Using hypervector algebra, the system infers that the answer is Mexican peso (mpe).
We encode relationships like:
USA → (name, capital, currency)
Mexico → (name, capital, currency)
These are stored as bundled hypervectors:
USA = name ⊗ usa + capital ⊗ wdc + currency ⊗ usd
Mexico = name ⊗ mex + capital ⊗ cdmx + currency ⊗ mpe
We then compute a transformation:
T = Mexico ⊗ USA⁻¹
and apply it to usd:
T ⊗ usd ≈ mpe
Finally, we use cleanup (nearest neighbor search) to recover the closest known symbol.
- Binding (⊗) encodes relationships
- Bundling (+) aggregates facts
- Inverse (⁻¹) enables analogy transfer
- The same computation works across multiple HDV types
cargo run --example mexican
Binary
=========
Nearest HDV is: mpe
Bipolar
=========
Nearest HDV is: mpe
Modular
=========
Nearest HDV is: mpe
ComplexHDV
=========
Nearest HDV is: mpe
RealHDV
=========
Nearest HDV is: mpe- All hypervectors are randomly generated but reproducible (fixed seed).
- Different representations (binary, bipolar, complex, etc.) yield the same result.
- Dimensionality affects robustness but not the underlying logic.