HyperdimensionalComputing.jl

Hyperdimensional computing (HDC), also known as vector symbolic architectures (VSA), is a brain-inspired paradigm that represents information as very high-dimensional vectors – hypervectors, typically 10,000 dimensions. In such spaces two random vectors are almost always nearly orthogonal, and that single fact makes it possible to superpose, associate and sequence concepts inside one fixed-size vector without them interfering.

Because information is spread across all D dimensions rather than stored in particular ones, the representation degrades gracefully: a hypervector can lose a large fraction of its components and still be recognised. The operations reduce to bit arithmetic, and the whole paradigm fits in a few hundred lines of code. Stock et al. (2024), cited below, survey where this pays off on biological data.

Installation

using Pkg; Pkg.add(url = "https://github.com/Kermit-UGent/HyperdimensionalComputing.jl")

A first taste

using HyperdimensionalComputing

## every object gets its own deterministic, quasi-orthogonal hypervector
cat = encode(BipolarHV, "cat")
dog = encode(BipolarHV, "dog")
similarity(cat, dog)
-0.0004
## bundling superposes: the result resembles each of its parts
pets = bundle([cat, dog])
similarity(pets, cat), similarity(pets, dog)
(0.4948, 0.5048)
## binding associates, and undoes itself
role = encode(BipolarHV, :pet)
(role * cat) / role == cat
true

How the package is organised

The package is built in three layers, and it helps to know which one you are working in:

LayerSignatureMembers
Primitiveshypervector → hypervectorbundle (+), bind (*), unbind (/), shift (ρ), perturbate
Combinatorscollection of hypervectors → hypervectormultiset, multibind, bundlesequence, bindsequence, hashtable, crossproduct, ngrams, graph
Encodersraw data → hypervectorencode with KMer/NGram/Sequence/BagOfSymbols, and the stateful LevelEncoder and RandomProjection

Seven vector symbolic architectures are available – BinaryHV, BipolarHV, TernaryHV, RealHV, GradedHV, GradedBipolarHV and FHRR – all sharing the AbstractHV interface, so an application can usually switch between them by changing a single name.

Where to go next

  • Introduction to HDC – the operations, taught by cooking a taco and a hamburger. Start here.
  • Encoding data – turning tokens, sequences, numbers and feature vectors into hypervectors; includes recognising languages from character k-mers.
  • Colours – random projections for continuous data, associative memories, and the link to kernel methods.
  • What's the Dollar of Mexico? – Kanerva's classic analogical-reasoning example.
  • Iris dataset – a complete classification workflow on numeric data.
  • API reference – every exported function.

Citing

If you use this package in research, please cite the review it accompanies:

Stock, M., Van Criekinge, W., Boeckaerts, D., Taelman, S., Van Haeverbeke, M., Dewulf, P., De Baets, B. (2024). Hyperdimensional computing: A fast, robust, and interpretable paradigm for biological data. PLOS Computational Biology 20(9), e1012426. doi:10.1371/journal.pcbi.1012426