Understanding the concatenation in the DateTime Encoder video

I understand the “why” of using different size SDR representations for each component (sizing semantic information equivalently) but I am not sure I follow the example fully. At 9:32 in the video, Matt resets the “bucket width” to 21. Here are the relevant descriptions of each component:

  • day of week: n = 147, w = 12, b = 136
  • weekend: n =42, w = 12, b = 31
  • time of day: n = 54, w = 12, b = 43
  • season: n = 85, w = 12, b = 74

^ using b = (n - w) + 1 formula to calculate the number of buckets.

My questions (in no particular order):

  • I thought I understood “bucket width” to be equivalent to w but here they are 12 not 21. Is that just a visualisation problem since each has a consistent w?
  • The day of week buckets look to be exclusive (no overlap, for example, between Monday and Tuesday). If the w is 12 then wouldn’t n only need to be 84? Why is n = 147?
  • Reading the API docs, I see that for the DateEncoder there, a radius of 4 and 91.5 is used for the time of day and season portions. From this I understand why their n is smaller than day of week even if the radius in the visuals doesn’t appear to match the API encoder (visual looks like it changes on 1 pixel on each week where a radius of 91.5 would suggest it change on a 3-month schedule).

Maybe, at the end of the day, what I am struggling to understand is how, in the video, the n is determined for each component given the common w of 12. Would someone be able to explain that to me? Perhaps that would answer the questions above, too.


So first of all, thanks for watching my video, but it has been awhile since I wrote that code. It may have an error somewhere.

The number of buckets is not the same as w. When you think of an SDR as an encoding space, think of buckets as the number of distinct places you can store values. So for a 100 length SDR with 10 bits on, it’s easy to think you can slide 10 continuous bits through that 100-bit space. It can be in 90 positions in that space, right? So I’d say one way to encode into that space is to separate it into 90 buckets and spread your semantics across those 90 buckets.

And to your other questions regarding the code, I did not use the NuPIC date encoder. I wrote my own for the example. I am not garaunteeing its accuracy, it was only meant for education.