Exploring htm.core and the TM parameters

Not sure if this is useful for anyone else, but playing around with the temporal memory parameters certainly helps me to understand more and more as I move along.
https://3rdman.de/2020/04/hierarchical-temporal-memory-part-2/
Any feedback would be highly appreciated.

Cheers!

8 Likes

Nice work @indy!

I like how you use animation and console printing to look inside the TM.
Any plans to expand them to show higher order patterns and multiple cells per column? Like the ‘A,B,C,D’ vs ‘X,B,C,Y’ base case?.
For newcomers I think this’ll help show how what makes HTM so special capacity-wise.

2 Likes

Thanks a lot @sheiser1 for your feedback!
Yes, the plan is to start exploring the higher order memory by using two cells per column in the next post.

2 Likes

@indy this is great! There is too little documentation on the TM parameters and what happens when you change them.

1 Like

@indy, this is really good.
Can we add a link to this from README.md in htm.core?

1 Like

Thanks a lot @rhyolight. For me, one of the most effective ways to learn is when I have to explain it to someone else.

2 Likes

@David_Keeney absolutely! Glad if I can contribute something to the excellent work you guys are doing.

2 Likes

The second part related to exploring htm.core and the TM parameters is now online: https://3rdman.de/2020/04/hierarchical-temporal-memory-high-order-sequence-memory

Thanks again for any feedback you might have.

3 Likes

These blog posts are absolutely delightful. I appreciate your ability to produce visualizations.

Thank you!

Thank you very much @MaxLee!

Hi!

I have a question, the tutorial explains that the temporal memory needs at least 8 active bits to work as expected, so consequently, each number must be represented with minimum 8 ones.

Which is the reason why we need a minimum number of 8 active bits?

Thank you in advance.

1 Like

One technical reason is that in order to activate, a dendrite needs an average 6 input synapses to fire simultaneously. That’s a biology inheritance.

TM is designed to handle noisy or foggy environments, where not everything is as sharply distinguishable as a 5 vs a 6. Quantities are approximates.
If there are fewer than 6 simultaneous active inputs, then it increases the chance of incorrect activating the dendrite.

Now why not just set the encoding to 6 bits instead of 8? Because it accounts for possibility some of the bits will be missed.

Of course you might argue that if you carefully select encodings and avoid “making noise” from the very start the above arguments don’t really apply.

In this case you can indeed reduce both SDR length and solidity (number of ON bits) to e.g. 3 bits, but you’ll have to remember to reduce the dendrite activation threshold from 6 to no more than 3.

But still you might want to reuse a TM trained “in vitro” in a different context where some other module approximately outputs the number sequence you trained for, and if you stack on that a TM trained on a “narrow”, precise encoding, it will perform poorly.


Another reason you can call it “proximity influence”. Not sure how it matters in TM, but I used SDR encodings for input in the RLtask of balancing the cartpole, and I found that exagerated “thick” SDRs from HTM perspective perform very well. The agent learns much faster with 30% solidity than with 15%, 5% or smaller

The reason is that when you have a robot that learns whether to move left or right, on input it never seen before, with more solid SDRs it increase the chances of making a good enough choice because the new (unseen) number encoding has a significant overlap with one (or more) close previous value(s) for which it already learned the correct answer.

So it is important to:

  • between encodings of close values have a high overlap.
  • overlap should be gradual - the farther away two numbers, the less overlap, till they become entirely different encodings

For the reasons above is a good choice to begin with fairly “thick” encodings, to encode not only the value you want but also to have a gradual shift between neighboring values and resist noise.

1 Like