Introducing HTMHelper. A a header only NuPIC.core abstraction library


Hi all!
I’ve spent the past few days cleaning up my NuPIC.core wrapper that I have used in serval projects. Hopefully this project will allow more folks to learn about HTM and eventually expand the community.

The project folder also includes demo applications; including programs to classify Iris species and solving the XOR problem. These should be familiar with Deep Learning engineers and allow them to learn the concept of HTM faster. Also. HTMHelper provides consistent layer API. - No more vector nightmare like dealing with NuPIC.core directly.

Layers and features

  • Layers
    • SpatialPooler
    • TemporalMemory
    • TemporalPooler (Cells4)
  • Encoders
    • ScalarEncoder
    • CategoryEncoder
      • Including a decocder!
  • Classifers
    • SDRClassifer
  • Other
    • Raw anomoly


Iris classifcation

The XOR problem

Way cleaner code than NuPIC.core

A lot is still the subject to change as the project is still in it’s early stage. Please open an issue if you find a bug or better open a pull request if you have implemented an awesome idea!


Great work!


Is the “TemporalPooler (Cells4)” the old proposal of the temporal pooler? Because If I remember well, there still isn’t a well defined way to group or “pool” sequences in order to recognise sequences within sequences and similar tasks.


I don’t actually know. @rhyolight Can you share some infomation?


Cells4 is a tool, not a temporal pooler. There are two types of temporal memory algorithms in core, one is called “backtracking” and has non biological elements. There is no “temporal pooler” as described.


@rhyolight. Why does the comment in Cells4.hpp say it is a temporal pooler?

Cells4.hpp L42:
The Cells4 class is the primary class implementing the C++ version of the temporal pooler.

Are there any benefits or reason to use Cells4 instead of TemporalMemory? It seems difficult to control (at least acts weirdly comparing to TM), slower and is the primary implementation for some reason?

And while TemporalMemory is horrible at learning XOR yet Cells4 learns it in a single shot.


@marty1885 - The whole HTM concept is a work in progress.

This is inevitable in a research-oriented organization; as the basic ideas are tested and the results are evaluated some ideas are confirmed, others are modified or rejected.

We (as a community) benefit from being allowed to access this cutting-edge work as soon as it is available. The downside to this is the long tail of documentation and supporting software is not always up to date.

If you find this to be disconcerting you can always wait until the research is done, the results adopted by academia, with textbooks and classes teaching this as orthodoxy.

You may have to wait a few decades for this to happen.

I find that being exposed to new and untested ideas to be exhilarating and worth the extra effort to keep track of what is current and what has been tested and confirmed or abandoned. I don’t know that there is a single point that you can look at to learn this but I read the most current papers and work backwards looking for what has changed. @rhyolight Matt is pretty good about pointing out some of this if asked.


Thanks. I’m aware of that. I just get confused when learning HTM by reading NuPIC/NuPIC.core as the material.

A centralized place for everyone to see what has been done and what failed seems to be a good idea.


Hey @mrcslws, when you have a moment can you help here? I’m not really familiar enough with Cells4 or C++ in general to respond here.


I would not recommend learning HTM by reading code in nupic.core. The python code in nupic is functionally the same and easier to read.


Not sure about “Cells4” specifically, but backtracking is a non-biological solution to a known problem with the current HTM theory. The basic idea is that when bursting occurs, it runs simulations to check “would this have bursted if the sequence had started more recently?” This is why it yields better results to some problems (at the cost of being slower).

The solution IMO will likely come out of research into attention, which will need a mechanism for representing and moving between the components of composite objects (I believe this will be applicable to sequences and subsequences)


The BacktrackingTM is constructed using calls to Cells4 and Cell. This is kind of a lower layer of code.

The TemporalMemory uses Connections to do similar things. TemporalMemory is the more accepted algorithm of the two.