I worked out what the problem with that test is. This is a P=10 run with only 8 element vectors being used.
If you run it with P=8 and the same digits, then the answers are correct.
I built the same test harness around the C implementation, as the one for python.
This shows significantly better results.
The axes and criteria are the same as further above.
There must be important implementation differences between the C and Python versions.
Zooming in slightly you can see a usable zone with perfect recall (the zero line).
Negative scores mean you are losing elements from z and positive means you are getting extra (incorrect) elements.
Obvious any run produces a different random vector set so performance will vary slightly.
numbified query would reach a decent 15k queries/second rate.
@POv “numbifying” means using a just in time compiler package named numba. It has its quirks&limitations and code looks uglier and slightly longer than pure python
I provided a sdrsdm.py on both mine and Peter’s github. Implements TriadicMemory and DiadicMemory (which stores a value SDR under a key SDR)
Using numba makes it really fast - DiadicMemory exceeds 100k writes/second and performs queries at a rate of 18k/sec
Though that performance is with a relatively short, very sparse SDR of 10/1000 bits Mine has DiadicMemory test code included in “main”
Peter’s is clean library - example usage and tests will follow
As expected performance degrades with solidity (number of ON bits) yet for 32/2048 bits SDRs it still has a decent >8k/sec writes and >4k/sec reads.
Memory footprint for 2048bit SDRs is ~4GByte
Recall is virtually 100% until a certain threshold of write operations.
On the above 32/2048 SDRs this threshold is around 0.7-0.8 million random writes.
After the threshold errors are quite often but even then, most wrong SDRs are one bit wrong.
PS the above figures are for diadic memory
To make things clearer:
diadic memory maps one key SDR x to one value SDR y. The relationship is unidirectional, cannot query the key knowing the value.
triadic memories maps three SDRs x,y,z to each other, which means any member of the triplet can be remembered with partial knowledge of the other two members.