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

Warning on normalizing vectors with zero norm #120

Closed mikeheddes closed 5 months ago

mikeheddes commented 1 year ago

In the cos_similarity and Centroid.normalize a divide by zero is prevented by setting a minimal vector norm of some small epsilon. When a norm less than this epsilon occurs a warning should be printed that reports this to the user because this most likely means that there is a bug. E.g., one class has no training samples.