hyperdimensional-computing / torchhd

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

Bug in EMG Example #135

Closed krabo0om closed 1 year ago

krabo0om commented 1 year ago

https://github.com/hyperdimensional-computing/torchhd/blob/6b69e364adce6c4469c0e667dd28cd4d52d4d970/examples/emg_hand_gestures.py#L42

Should be samples instead:

samples = torchhd.bind(samples, self.timestamps.weight.unsqueeze(1))
mikeheddes commented 1 year ago

Thank you for reporting this bug! With the fix the accuracy is also improved, from:

List of subjects [0]
Testing accuracy of 94.937%
List of subjects [1]
Testing accuracy of 93.919%
List of subjects [2]
Testing accuracy of 86.897%
List of subjects [3]
Testing accuracy of 93.007%
List of subjects [4]
Testing accuracy of 76.238%

Which is now:

List of subjects [0]
Testing accuracy of 98.734%
List of subjects [1]
Testing accuracy of 96.622%
List of subjects [2]
Testing accuracy of 99.310%
List of subjects [3]
Testing accuracy of 97.902%
List of subjects [4]
Testing accuracy of 97.030%

I will go ahead and make a PR and a new release of the library.