Looking for some assistance with hashing functions

Hello there. I’m working on writing an HTM implementation from scratch in Python since I can’t seem to find anything under Python3. I’ve gotten through most of the first steps for a single value encoder, but I’m having trouble understanding how to use the hash function to select which bits are in which bucket. The page I’m looking at seems to be very sparse on specifics here; it’s just illustrated by some arrows. I understand how a hash function works, but I don’t understand how to implement it to find a mapping schema like this. Does anyone have an example that I can look at to understand how this is supposed to work? Also, is this the same method used for initializing connections between SDR layers for the first time? If so, how different does that look?

If I’m just not reading far enough to find this, just let me know.

1 Like

Hi @Socradeez welcome!

Firstly there is a Python 3 implementation of NuPIC:

For the hashing question it sounds like the RDSE to me (Random Distributed Scalar Encoder).
I’d recommend checking out the source here:

You sir have just saved me likely days of fiddling with bit arrays to get this implementation to work. Thank you.

1 Like