hyperdimensional-computing / torchhd

Torchhd is a Python library for Hyperdimensional Computing and Vector Symbolic Architectures
https://torchhd.readthedocs.io
MIT License
229 stars 24 forks source link

Implementing circular hypervectors with the Holographic Reduced Representations model #108

Open mikeheddes opened 1 year ago

mikeheddes commented 1 year ago

The unit tests for circular hypervectors don't currently pass with the HRR model. I am not sure why this is as I expected it to behave very similarly to the FHRR model which does pass the unit tests. The failing test can be found here.

What happens is that in the second half of the circle the similarity with respect to the starting point is not increasing:

HRR([ 1.,  1.,  1.,  1.,  1., -1., -1.], dtype=torch.float64) 
HRR([0.2494, 0.2501, 0.2496, 0.2519, 0.0005, 0.0006, 0.0011], dtype=torch.float64)

The first array shows the signs of changes and the second array the change itself. These arrays should look something like this instead:

HRR([ 1.,  1.,  1.,  1.,  -1., -1., -1.], dtype=torch.float64) 
HRR([0.2494, 0.2501, 0.2496, 0.2519, 0.2500, 0.2500, 0.2500], dtype=torch.float64)