Putting out fires with gasoline!

(to borrow a line from David Bowie)

Yes! There was a major issue with the HTM.java Network API! The wrong output was being taken from the TemporalMemory and passed to the CLAClassifier! The classifier was being passed the columns derived from the predict(ive) cells when it was supposed to be passed the activeCells (that’s right, no columns)!

Who would’a thunk it?

As there are no integration tests which demonstrate what gets passed between algorithms, there is no way to really confirm or intuit this. Rest assured, all is right with the world (and HTM.java) now – but it was a real pour-gasoline-over-body-light-with-match kind of moment! (see issue #2684 here)

Long story made short – part of the HTM.java Network API needed to be re-written; but this is how it happened…

Last week a NuPIC Community member, (Sebastian Narvaez R. – a.k.a. @larvasapiens), asked a question regarding how one could learn the ins and outs of NuPIC in a way where they can experiment with code easily. I mentioned that I had some example code that shows (in the most simple rudimentary way possible), how to connect the basic algorithms together (i.e. the ScalarEncoder, SpatialPooler, TemporalMemory, CLAClassifier). Well thank GOD I did, because it started a domino land slide which led to some great realizations.

So anyway, I offered to give him either the QuickTest.java or QuickTest.py file – depending on his particular flavor preference. Much to my chagrin :-/ he requested the Python version. Later that night I received a PM from him over Gitter.im, mentioning that he had had problems with the classification and that by changing the classifier’s input from a vector of column indexes derived from TM predicted cells, he merely gave it the TM’s active cells. Well I kinda chuckled to myself and answered confidently… “well that can’t be right!”. (Jokes on me). I then asked him to write the NuPIC Hacker’s mailing list and ask what the proper input is (read the archived convo)

Subutai (VP of Research at Numenta) proceeded to answer the list and simultaneously drop a bomb on my head!

So here’s the technical explanation:

The SpatialPooler outputs a vector of column activations. The TemporalMemory then takes those columns and gets a list of all those cells in each of those columns. It then performs an intersection of those cells and the cells which were predicted in the previous compute cycle (“t – 1”). If they “intersect”, they get added to the list of “activeCells” for the current compute cycle. These active cells are what is handed off to the CLAClassifier.

If we merely handed off the columns for those cells we would lose the temporal context information… Here’s why…




So by handing off the columns instead of the cells, we basically lose a lot of the important information which contributes to the correct prediction of the input, because the prediction depends on the sequences of what’s previously activated (temporal context).

So in conclusion…



To be fair, as mentioned before there are no integration tests which illustrate what goes where once it/they leave any particular algorithm, I just assumed “columns” were the payload of choice. Incidently, we do however take the columns from the predictive cells and hand those off to the Anomaly (computer) class for anomaly computations. Ahhhh. Lessons learned…

See you in the next “learning moment”…




4 Responses to “Putting out fires with gasoline!

  • David, it is very honorable of you to post this. This is hard stuff, and everyone makes mistakes, so don’t beat yourself up over it. You have done an outstanding job with HTM.java, which is evident in how many people are trying to use it right now. Keep up the good work!

    • Thanks Matt. …and thank you for being my “compass” and helping keep pointed in the “right” direction! That is after all, the purpose of this blog (to share my learning experiences)! 🙂

  • Simply desire to say your article is as astonishing.
    The clarity on your publish is just spectacular and i can think you’re an expert in this subject.

    Fine along with your permission allow me to clutch your RSS feed to stay up to date with approaching post.

    Thanks a million and please continue the rewarding work.

  • Hmm it appears like your site ate my first comment (it was super long) so I guess I’ll just sum it up what I had written and say, I’m thoroughly enjoying your blog.
    I as well am an aspiring blog blogger but I’m still new to the whole thing.

    Do you have any tips for newbie blog writers? I’d certainly appreciate it.

Leave a Reply Text

Fork me on GitHub