Yet another "Yet Another HTM Implementation"

A bucket basically represents a range of numbers all at once. Short example:

Say we are encoding the values 1-100, and decide the use 10 buckets. If we use num_active_bits = 1, then our scalar encoder outputs an SDR with ten bits: 0000000000

Each bit represents 1/10 of the input space, so bucket 1 would be on for all values 1-10, bucket 2 would be on for all values 11-20, bucket 3 for 21-30, etc:

  • input 01 --> output 1000000000
  • input 05 --> output 1000000000
  • input 10 --> output 1000000000
  • input 11 --> output 0100000000
  • input 55 --> output 0000010000
  • input 99 --> output 0000000001

This is very similar to how a histogram works, or any other “range banding” generalization: convert a large number of inputs into a smaller number of outputs.

You might look at this test for some more on how the scalar encoder is expected to behave.

You can also check out the section called “A Simple Encoder for Numbers” from the encoder chapter (pdf!) of BAMI, as my encoder basically just implements the one described in that section.

3 Likes