Minor corrections to Temporal Memory document (ver 0.4)

Thought I would recommend some minor corrections to the Temporal Memory document that I identified while I was studying it. Of course pseudocode isn’t meant to be syntactically precise, but a few tweaks will help improve comprehensibility. These are all very minor, so hopefully this post isn’t taken as any sort of criticism – this document is extremely useful and well put together! I just figured these are some things that could be edited in future versions of the document in case any of them have been overlooked. These are relevant to version 0.4 here.

On page 8, pseudocode lines 5 and 22, the conditional statements checking for predictive state are comparing against Boolean “true”. Everywhere else in the pseudocode, states are defined as “1” or “0” (versus Booleans “true” or “false”). Recommend either changing these two lines to “== 1”, or using Booleans consistently throughout the pseudocode for states: (if choosing the latter, then the relevant data structure definitions on page 10 may also need to be tweaked a bit, since they refer to the number “1”)


On page 9, pseudocode line 36, variable “i” is capitalized, which in the document’s font appears to be a lowercase “L”. When first reading this, it takes a minute to realize variable “i” referenced in lines 37 and 38 refers to the value set on this line:

On page 9, pseudocode line 48, there is a reference to variable “s” which is not defined in this scope. This should be a reference to variable “c” instead of “s”:

On page 9, the pseudocode for Phase 3 appears to have a logic error. The segment update list for a cell is only cleared if one of the two conditions are met. This means if one of those conditions are not met (for example, correctly predicted active cells that are not in learn state), then the list for that cell will carry over into the next time step. This could lead to unexpected behavior if the conditions in the next time step cause these stale update lists to be executed. Recommend deleting line 50, and reducing indentation of line 53 so that it executes for every iteration of the loop:

On page 11, the definition for supporting routine “getActiveSegment” refers to “sequence segments”. Since all other references to “sequence segments” have been removed from this version of the document, I suspect this one was overlooked (otherwise it is definitely not clear from this document what is the difference between a “sequence segment” versus any other segment). Recommend changing this to read “If multiple segments are active, the one with the most active synapses is selected”:

On page 12, the header for supporting routine “getSegmentActiveSynapses” has params “s” and “t” in the wrong order:


Once again, excellent work on this document! Hopefully this post isn’t taken the wrong way…

1 Like

I missed one:

One page 12, the header for supporting routine “getBestMatchingCell” is missing parameter t:

Paul, Thanks for these corrections to the current Temporal Memory pseudocode in BAMI. We’re in the process of updating this pseudocode to accurately reflect the current TM implementation, so we’ll make sure to go over your comments before we publish the new version.

1 Like